ソースを参照

improved template logic

Serghey Rodin 13 年 前
コミット
ef33765d31
56 ファイル変更710 行追加282 行削除
  1. 9 3
      bin/v_add_dns_domain
  2. 15 28
      bin/v_add_web_domain
  3. 2 2
      bin/v_add_web_domain_alias
  4. 2 2
      bin/v_add_web_domain_elog
  5. 11 5
      bin/v_add_web_domain_nginx
  6. 1 1
      bin/v_add_web_domain_ssl
  7. 2 2
      bin/v_backup_user
  8. 1 1
      bin/v_change_user_package
  9. 48 0
      bin/v_change_user_template
  10. 2 2
      bin/v_change_web_domain_ip
  11. 4 4
      bin/v_change_web_domain_nginx_tpl
  12. 1 1
      bin/v_change_web_domain_sslhome
  13. 0 13
      bin/v_change_web_domain_tpl
  14. 2 2
      bin/v_delete_web_domain
  15. 2 2
      bin/v_delete_web_domain_alias
  16. 2 2
      bin/v_delete_web_domain_elog
  17. 2 2
      bin/v_delete_web_domain_nginx
  18. 1 1
      bin/v_delete_web_domain_ssl
  19. 18 24
      bin/v_list_dns_templates
  20. 1 1
      bin/v_list_user
  21. 3 3
      bin/v_list_user_packages
  22. 12 11
      bin/v_list_users
  23. 2 2
      bin/v_list_web_domain
  24. 1 1
      bin/v_list_web_domains
  25. 20 37
      bin/v_list_web_templates
  26. 22 41
      bin/v_list_web_templates_nginx
  27. 2 2
      bin/v_rebuild_web_domains
  28. 2 2
      bin/v_suspend_web_domain
  29. 2 2
      bin/v_unsuspend_web_domain
  30. 1 1
      data/packages/default.pkg
  31. 1 1
      data/packages/gainsboro.pkg
  32. 1 1
      data/packages/palegreen.pkg
  33. 14 0
      data/packages/slategrey.pkg
  34. 36 0
      data/templates/web/nginx_default.stpl
  35. 33 0
      data/templates/web/nginx_default.tpl
  36. 28 18
      func/domain.sh
  37. 12 4
      web/add/dns/index.php
  38. 12 5
      web/add/web/index.php
  39. 8 3
      web/edit/dns/index.php
  40. 18 1
      web/edit/user/index.php
  41. 7 2
      web/edit/web/index.php
  42. 15 14
      web/templates/admin/add_dns.html
  43. 1 1
      web/templates/admin/add_mail.html
  44. 16 13
      web/templates/admin/add_web.html
  45. 4 4
      web/templates/admin/edit_dns.html
  46. 15 0
      web/templates/admin/edit_user.html
  47. 7 6
      web/templates/admin/edit_web.html
  48. 3 3
      web/templates/admin/list_user.html
  49. 0 1
      web/templates/admin/list_web.html
  50. 2 1
      web/templates/login.html
  51. 51 0
      web/templates/user/add_dns.html
  52. 87 0
      web/templates/user/add_web.html
  53. 35 0
      web/templates/user/edit_dns.html
  54. 108 0
      web/templates/user/edit_web.html
  55. 3 3
      web/templates/user/list_user.html
  56. 0 1
      web/templates/user/list_web.html

+ 9 - 3
bin/v_add_dns_domain

@@ -19,7 +19,7 @@ domain=$(idn -t --quiet -u "$2" )
 domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain_idn=$(idn -t --quiet -a "$domain")
 ip=$3
-template=${4-default}
+template=$4
 next_year=$(date +%F -d "+ 1 year")
 exp=${5-$next_year}
 soa=$6
@@ -36,13 +36,19 @@ source $VESTA/func/domain.sh
 #----------------------------------------------------------#
 
 check_args '3' "$#" 'user domain ip [template] [exp] [soa] [ttl]'
-validate_format 'user' 'domain' 'ip' 'template' 'exp' 'ttl'
+validate_format 'user' 'domain' 'ip' 'exp' 'ttl'
 is_system_enabled "$DNS_SYSTEM"
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
 is_domain_new 'dns'
 is_package_full 'DNS_DOMAINS'
-is_dns_template_valid
+if [ ! -z "$template" ]; then
+    validate_format 'template'
+    is_dns_template_valid
+else
+    template=$(get_user_value '$TEMPLATE')
+    is_dns_template_valid
+fi
 
 
 #----------------------------------------------------------#

+ 15 - 28
bin/v_add_web_domain

@@ -20,7 +20,7 @@ domain=$(idn -t --quiet -u "$2" )
 domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
 domain_idn=$(idn -t --quiet -a "$domain")
 ip=$3
-template=${4-default}
+template=$4
 restart=$5
 
 # Includes
@@ -35,7 +35,7 @@ source $VESTA/func/ip.sh
 #----------------------------------------------------------#
 
 check_args '3' "$#" 'user domain ip [template] [restart]'
-validate_format 'user' 'domain' 'ip' 'template'
+validate_format 'user' 'domain' 'ip'
 is_system_enabled "$WEB_SYSTEM"
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
@@ -43,7 +43,13 @@ is_domain_new 'web'
 is_ip_valid
 is_ip_avalable
 is_package_full 'WEB_DOMAINS'
-is_apache_template_valid
+if [ ! -z "$template" ]; then
+    validate_format 'template'
+    is_apache_template_valid
+else
+    template=$(get_user_value '$TEMPLATE')
+    is_apache_template_valid
+fi
 
 
 #----------------------------------------------------------#
@@ -74,28 +80,9 @@ email="$user@$domain"
 docroot="$HOMEDIR/$user/web/$domain/public_html"
 conf="$HOMEDIR/$user/conf/web/httpd.conf"
 tpl_file="$WEBTPL/apache_$template.tpl"
-
-# Parsing template keys
-template_data=$(cat $WEBTPL/apache_$template.descr|grep -v '#')
-for keys in $template_data; do
-    eval ${keys%%=*}=${keys#*=}
-done
-
-# Checking error log status
-if [ "$ELOG" = 'no' ]; then
-    elog='#'
-else
-    elog=''
-fi
-
-# Checking cgi
-if [ "$CGI" != 'yes' ]; then
-    cgi='#'
-    cgi_option='-ExecCGI'
-else
-    cgi=''
-    cgi_option='+ExecCGI'
-fi
+elog=''
+cgi=''
+cgi_option='+ExecCGI'
 
 # Adding domain to the httpd.conf
 add_web_config
@@ -181,9 +168,9 @@ increase_user_value "$user" '$U_WEB_ALIASES'
 
 # Defining domain variables
 str="DOMAIN='$domain' IP='$ip' IP6='' ALIAS='$aliases' TPL='$template'"
-str="$str $template_data SSL='no' SSL_HOME='single' NGINX='' NGINX_EXT=''"
-str="$str STATS='' STATS_USER='' STATS_CRYPT='' U_DISK='0' U_BANDWIDTH='0'"
-str="$str SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
+str="$str CGI='yes' ELOG='yes' SSL='no' SSL_HOME='single' NGINX=''"
+str="$str NGINX_EXT='' STATS='' STATS_USER='' STATS_CRYPT='' U_DISK='0'"
+str="$str U_BANDWIDTH='0' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
 
 # Registering domain
 echo "$str" >> $USER_DATA/web.conf

+ 2 - 2
bin/v_add_web_domain_alias

@@ -73,13 +73,13 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     add_web_config
 
     if [ "$SSL" = 'yes' ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.stpl"
         conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         add_web_config

+ 2 - 2
bin/v_add_web_domain_elog

@@ -66,13 +66,13 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     add_web_config
 
     if [ "$SSL" = 'yes' ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.stpl"
         conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         add_web_config

+ 11 - 5
bin/v_add_web_domain_nginx

@@ -14,7 +14,7 @@
 user=$1
 domain=$(idn -t --quiet -u "$2" )
 domain_idn=$(idn -t --quiet -a "$domain")
-template=${3-default}
+template=$3
 default_extentions="jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,doc,xls,\
 exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm"
 extentions=${4-$default_extentions}
@@ -31,14 +31,20 @@ source $VESTA/func/domain.sh
 #----------------------------------------------------------#
 
 check_args '2' "$#" 'user domain [template] [extentions] [restart]'
-validate_format 'user' 'domain' 'template' 'extentions'
+validate_format 'user' 'domain' 'extentions'
 is_system_enabled "$PROXY_SYSTEM"
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
 is_object_valid 'web' 'DOMAIN' "$domain"
 is_object_unsuspended 'web' 'DOMAIN' "$domain"
 is_object_value_empty 'web' 'DOMAIN' "$domain" '$NGINX'
-is_nginx_template_valid
+if [ ! -z "$template" ]; then
+    validate_format 'template'
+    is_nginx_template_valid
+else
+    template=$(get_user_value '$TEMPLATE')
+    is_nginx_template_valid
+fi
 
 
 #----------------------------------------------------------#
@@ -49,7 +55,7 @@ is_nginx_template_valid
 get_domain_values 'web'
 NGINX="$template"
 NGINX_EXT="$extentions"
-tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+tpl_file="$WEBTPL/nginx_$NGINX.tpl"
 conf="$HOMEDIR/$user/conf/web/nginx.conf"
 
 # Preparing domain values for the template substitution
@@ -69,7 +75,7 @@ fi
 
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     conf="$HOMEDIR/$user/conf/web/snginx.conf"
     add_web_config
 

+ 1 - 1
bin/v_add_web_domain_ssl

@@ -98,7 +98,7 @@ fi
 if [ ! -z "$NGINX" ]; then
     # Adding domain to the snginx.conf
     conf="$HOMEDIR/$user/conf/web/snginx.conf"
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     add_web_config
 
     chown root:nginx $conf

+ 2 - 2
bin/v_backup_user

@@ -163,14 +163,14 @@ then
 
         # Nginx config
         if [ ! -z "$NGINX" ] ; then
-            tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+            tpl_file="$WEBTPL/nginx_$NGINX.tpl"
             conf="$HOMEDIR/$user/conf/web/nginx.conf"
             get_web_config_brds
             sed -n "$top_line,$bottom_line p" $conf > conf/nginx.conf
 
             # SSL check
             if [ "$SSL" = 'yes' ] ; then
-                tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+                tpl_file="$WEBTPL/nginx_$NGINX.stpl"
                 conf="$HOMEDIR/$user/conf/web/snginx.conf"
                 get_web_config_brds
                 sed -n "$top_line,$bottom_line p" $conf > conf/snginx.conf

+ 1 - 1
bin/v_change_user_package

@@ -59,9 +59,9 @@ change_user_package() {
     echo "FNAME='$FNAME'
 LNAME='$LNAME'
 PACKAGE='$package'
+TEMPLATE='$TEMPLATE'
 WEB_DOMAINS='$WEB_DOMAINS'
 WEB_ALIASES='$WEB_ALIASES'
-WEB_TPL='$WEB_TPL'
 DNS_DOMAINS='$DNS_DOMAINS'
 DNS_RECORDS='$DNS_RECORDS'
 MAIL_DOMAINS='$MAIL_DOMAINS'

+ 48 - 0
bin/v_change_user_template

@@ -0,0 +1,48 @@
+#!/bin/bash
+# info: change user default template
+# options: user template
+#
+# The function changes default user web template.
+
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument defenition
+user=$1
+template=$2
+
+# Includes
+source $VESTA/conf/vesta.conf
+source $VESTA/func/main.sh
+source $VESTA/func/domain.sh
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '2' "$#" 'user template'
+validate_format 'user' 'template'
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+is_apache_template_valid
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+
+#----------------------------------------------------------#
+#                       Vesta                              #
+#----------------------------------------------------------#
+
+# Changing user shell
+update_user_value "$user" '$TEMPLATE' "$template"
+
+# Logging
+log_event "$OK" "$EVENT"
+
+exit

+ 2 - 2
bin/v_change_web_domain_ip

@@ -60,14 +60,14 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     replace_web_config
 fi
 
 # Checking nginx
 if [ "$SSL" = 'yes' ] && [ ! -z "$NGINX" ]; then 
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     conf="$HOMEDIR/$user/conf/web/snginx.conf"
     replace_web_config
 fi

+ 4 - 4
bin/v_change_web_domain_nginx_tpl

@@ -48,7 +48,7 @@ is_nginx_template_valid
 
 # Parsing domain values
 get_domain_values 'web'
-tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+tpl_file="$WEBTPL/nginx_$NGINX.tpl"
 conf="$HOMEDIR/$user/conf/web/nginx.conf"
 
 # Delete old vhost
@@ -56,7 +56,7 @@ del_web_config
 
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     conf="$HOMEDIR/$user/conf/web/snginx.conf"
     del_web_config
 fi
@@ -64,7 +64,7 @@ fi
 # Add new vhost
 NGINX="$template"
 NGINX_EXT="$extentions"
-tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+tpl_file="$WEBTPL/nginx_$NGINX.tpl"
 conf="$HOMEDIR/$user/conf/web/nginx.conf"
 upd_web_domain_values
 add_web_config
@@ -73,7 +73,7 @@ chmod 640 $conf
 
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     conf="$HOMEDIR/$user/conf/web/snginx.conf"
     add_web_config
     chown root:nginx $conf

+ 1 - 1
bin/v_change_web_domain_sslhome

@@ -56,7 +56,7 @@ replace_web_config
 
 # Checking nginx config
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     conf="$HOMEDIR/$user/conf/web//snginx.conf"
     replace_web_config
 fi

+ 0 - 13
bin/v_change_web_domain_tpl

@@ -61,12 +61,6 @@ fi
 upd_web_domain_values
 tpl_file="$WEBTPL/apache_$template.tpl"
 
-# Parsing new template
-template_data=$(cat $WEBTPL/apache_$template.descr | grep -v '#')
-for keys in $template_data; do
-    eval ${keys%%=*}=${keys#*=}
-done
-
 # Checking error log
 if [ "$ELOG" = 'no' ]; then
     elog='#'
@@ -104,13 +98,6 @@ fi
 # Changing tpl in config
 update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template"
 
-# Updating db keys
-for keys in $(cat $WEBTPL/apache_$template.descr|grep -v '#'); do
-    key=$(echo "$keys"| cut -f 1 -d '=' |sed -e "s/^/\$/g")
-    value=$(echo "$keys" |cut -f 2 -d \')
-    update_object_value 'web' 'DOMAIN' "$domain" "$key" "$value"
-done
-
 # Restart web
 if [ "$restart" != 'no' ]; then
     $BIN/v_restart_web "$EVENT"

+ 2 - 2
bin/v_delete_web_domain

@@ -70,12 +70,12 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
 
     if [ "$SSL" = 'yes' ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.stpl"
         conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
     fi

+ 2 - 2
bin/v_delete_web_domain_alias

@@ -72,13 +72,13 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     add_web_config
 
     if [ "$SSL" = 'yes' ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.stpl"
         conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         add_web_config

+ 2 - 2
bin/v_delete_web_domain_elog

@@ -64,13 +64,13 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     add_web_config
 
     if [ "$SSL" = 'yes' ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.stpl"
         conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         add_web_config

+ 2 - 2
bin/v_delete_web_domain_nginx

@@ -41,13 +41,13 @@ is_object_value_exist 'web' 'DOMAIN' "$domain" '$NGINX'
 
 # Defining domain parameters
 get_domain_values 'web'
-tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+tpl_file="$WEBTPL/nginx_$NGINX.tpl"
 conf="$HOMEDIR/$user/conf/web/nginx.conf"
 del_web_config
 
 # Checking ssl
 if [ "$SSL" = 'yes' ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     conf="$HOMEDIR/$user/conf/web/snginx.conf"
     del_web_config
 fi

+ 1 - 1
bin/v_delete_web_domain_ssl

@@ -49,7 +49,7 @@ del_web_config
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.stpl"
     conf="$HOMEDIR/$user/conf/web/snginx.conf"
     del_web_config
 fi

+ 18 - 24
bin/v_list_dns_templates

@@ -17,36 +17,30 @@ source $VESTA/func/main.sh
 
 # Json function
 json_list_dnstpl() {
-    echo '{'
-    for template in $(ls $DNSTPL/| grep '.descr'); do
-        if [ -n "$data" ]; then
-            echo -e '        },'
+    templates=$(ls -t $DNSTPL |grep '\.tpl' |cut -f 1 -d  '.')
+    t_counter=$(echo "$templates" | wc -w)
+    i=1
+    echo '['
+    for template in $templates; do
+        if [ "$i" -lt "$t_counter" ]; then
+            echo -e  "\t\"$template\","
+        else
+            echo -e  "\t\"$template\""
         fi
-        tpl_descr=$(cat $DNSTPL/$template |grep '#'|tr -d '\n')
-        tpl_name="${template//.descr/}"
-        echo -e  "\t\"$tpl_name\": {"
-        echo -e "\t\t\"DESCR\": \"${tpl_descr//# /}\""
-        data=1
+        (( ++i))
     done
-    if [ -n "$data" ]; then
-        echo -e '        }'
-    fi
-    echo -e '}'
+    echo "]"
 }
 
 # Shell function
 shell_list_dnstpl() {
-    for template in $(ls $DNSTPL/| grep '.descr'); do
-        tpl_name="${template//.descr/}"
-        tpl_descr=$(cat $DNSTPL/$template |grep '#')
-        if [ -z "$nohead" ] ; then
-            echo "----------"
-        fi
-        echo "TEMPLATE: $tpl_name"
-        echo "DESCRIPTION: ${tpl_descr//# /}"
-        if [ -z "$nohead" ] ; then
-            echo
-        fi
+    templates=$(ls -t $DNSTPL |grep '\.tpl' |cut -f 1 -d  '.')
+    if [ -z "$nohead" ]; then
+        echo "Templates"
+        echo "----------"
+    fi
+    for template in $templates; do
+        echo "$template"
     done
 }
 

+ 1 - 1
bin/v_list_user

@@ -72,7 +72,7 @@ is_object_valid 'user' 'USER' "$user"
 conf=$USER_DATA/user.conf
 
 # Defining fileds to select
-fields='$USER $FNAME $LNAME $PACKAGE $WEB_DOMAINS $WEB_ALIASES $WEB_TPL
+fields='$USER $FNAME $LNAME $PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_ALIASES
     $DNS_DOMAINS $DNS_RECORDS $MAIL_DOMAINS $MAIL_ACCOUNTS $DATABASES
     $CRON_JOBS $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $CONTACT
     $CRON_REPORTS $RKEY $SUSPENDED $SUSPENDED_USERS $SUSPENDED_WEB

+ 3 - 3
bin/v_list_user_packages

@@ -71,9 +71,9 @@ shell_list_pkgs() {
 #----------------------------------------------------------#
 
 # Defining fields
-fields='$PACKAGE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES $MAIL_DOMAINS
-    $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA $BANDWIDTH $NS
-    $SHELL $BACKUPS $WEB_TPL'
+fields='$PACKAGE $TEMPLATE $WEB_DOMAINS $WEB_SSL $WEB_ALIASES $DATABASES
+    $MAIL_DOMAINS $MAIL_BOXES $MAIL_FORWARDERS $DNS_DOMAINS $DISK_QUOTA
+    $BANDWIDTH $NS $SHELL $BACKUPS'
 
 # Listing domains
 case $format in

+ 12 - 11
bin/v_list_users

@@ -73,17 +73,18 @@ shell_list_users() {
 #----------------------------------------------------------#
 
 # Defining fileds to select
-fields="\$USER \$FNAME \$LNAME \$PACKAGE \$WEB_DOMAINS \$WEB_ALIASES \$WEB_TPL"
-fields="$fields \$DNS_DOMAINS \$DNS_RECORDS \$MAIL_DOMAINS \$MAIL_ACCOUNTS"
-fields="$fields \$DATABASES \$CRON_JOBS \$DISK_QUOTA \$BANDWIDTH \$NS \$SHELL"
-fields="$fields \$BACKUPS \$CONTACT \$CRON_REPORTS \$RKEY \$SUSPENDED"
-fields="$fields \$SUSPENDED_USERS \$SUSPENDED_WEB \$SUSPENDED_DNS"
-fields="$fields \$SUSPENDED_MAIL \$SUSPENDED_DB \$SUSPENDED_CRON \$IP_AVAIL"
-fields="$fields \$IP_OWNED \$U_USERS \$U_DISK \$U_DISK_DIRS \$U_DISK_WEB"
-fields="$fields \$U_DISK_MAIL \$U_DISK_DB \$U_BANDWIDTH \$U_WEB_DOMAINS"
-fields="$fields \$U_WEB_SSL \$U_WEB_ALIASES \$U_DNS_DOMAINS \$U_DNS_RECORDS"
-fields="$fields \$U_MAIL_DOMAINS \$U_MAIL_DKIM \$U_MAIL_ACCOUNTS \$U_DATABASES"
-fields="$fields \$U_CRON_JOBS \$U_BACKUPS \$TIME \$DATE"
+fields="\$USER \$FNAME \$LNAME \$PACKAGE \$TEMPLATE \$WEB_DOMAINS"
+fields="$fields \$WEB_ALIASES \$DNS_DOMAINS \$DNS_RECORDS \$MAIL_DOMAINS"
+fields="$fields \$MAIL_ACCOUNTS \$DATABASES \$CRON_JOBS \$DISK_QUOTA"
+fields="$fields \$BANDWIDTH \$NS \$SHELL \$BACKUPS \$CONTACT"
+fields="$fields \$CRON_REPORTS \$RKEY \$SUSPENDED \$SUSPENDED_USERS"
+fields="$fields \$SUSPENDED_WEB \$SUSPENDED_DNS \$SUSPENDED_MAIL"
+fields="$fields \$SUSPENDED_DB \$SUSPENDED_CRON \$IP_AVAIL \$IP_OWNED"
+fields="$fields \$U_USERS \$U_DISK \$U_DISK_DIRS \$U_DISK_WEB \$U_DISK_MAIL"
+fields="$fields \$U_DISK_DB \$U_BANDWIDTH \$U_WEB_DOMAINS \$U_WEB_SSL"
+fields="$fields \$U_WEB_ALIASES \$U_DNS_DOMAINS \$U_DNS_RECORDS"
+fields="$fields \$U_MAIL_DOMAINS \$U_MAIL_DKIM \$U_MAIL_ACCOUNTS"
+fields="$fields \$U_DATABASES \$U_CRON_JOBS \$U_BACKUPS \$TIME \$DATE"
 
 # Listing domains
 case $format in 

+ 2 - 2
bin/v_list_web_domain

@@ -75,8 +75,8 @@ is_object_valid 'web' 'DOMAIN' "$domain"
 conf=$USER_DATA/web.conf
 
 # Defining fileds to select
-fields='$DOMAIN $IP $IP6 $U_DISK $U_BANDWIDTH $TPL $ALIAS $PHP $CGI $ELOG
- $STATS $STATS_USER $SSL $SSL_HOME $NGINX $NGINX_EXT $SUSPENDED $TIME $DATE'
+fields='$DOMAIN $IP $IP6 $U_DISK $U_BANDWIDTH $TPL $ALIAS $CGI $ELOG $STATS
+ $STATS_USER $SSL $SSL_HOME $NGINX $NGINX_EXT $SUSPENDED $TIME $DATE'
 
 # Listing domains
 case $format in 

+ 1 - 1
bin/v_list_web_domains

@@ -34,7 +34,7 @@ is_object_valid 'user' 'USER' "$user"
 conf=$USER_DATA/web.conf
 
 # Defining fileds to select
-fields="\$DOMAIN \$IP \$IP6 \$U_DISK \$U_BANDWIDTH \$TPL \$ALIAS \$PHP \$CGI"
+fields="\$DOMAIN \$IP \$IP6 \$U_DISK \$U_BANDWIDTH \$TPL \$ALIAS \$CGI"
 fields="$fields \$ELOG \$STATS \$STATS_USER \$SSL \$SSL_HOME \$NGINX"
 fields="$fields \$NGINX_EXT \$SUSPENDED \$TIME \$DATE"
 

+ 20 - 37
bin/v_list_web_templates

@@ -10,65 +10,48 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user=$1
-format=${2-shell}
+format=${1-shell}
 
 # Includes
 source $VESTA/func/main.sh
 
 # Json function
 json_list_wtpl() {
+    templates=$(ls -t $WEBTPL |grep 'apache' |grep '\.tpl' |cut -f 2 -d '_'\
+        |cut -f 1 -d  '.')
+    t_counter=$(echo "$templates" | wc -w)
     i=1
-    echo '{'
-    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
-        if [ -e "$WEBTPL/apache_$template.descr" ]; then
-            descr=$(cat $WEBTPL/apache_$template.descr | grep '#'|\
-                sed -e ':a;N;$!ba;s/\n/ /g')
-            if [ $i -ne 1 ]; then
-                echo -e "\t},"
-            fi
-            echo -e  "\t\"$template\": {"
-            echo -e "\t\t\"DESCR\": \"${descr//# /}\""
-            (( ++i))
+    echo '['
+    for template in $templates; do
+        if [ "$i" -lt "$t_counter" ]; then
+            echo -e  "\t\"$template\","
+        else
+            echo -e  "\t\"$template\""
         fi
+        (( ++i))
     done
-    if [ -n "$template" ]; then
-        echo -e "\t}"
-    fi
-    echo '}'
+    echo "]"
 }
 
 # Shell function
 shell_list_wtpl() {
-    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
-        if [ -e "$WEBTPL/apache_$template.descr" ]; then
-            tpl_descr=$(cat $WEBTPL/apache_$template.descr |grep '#')
-            if [ -z "$nohead" ]; then
-                echo "----------"
-            fi
-            echo "TEMPLATE: $template"
-            echo "DESCRIPTION: ${tpl_descr//# /}"
-        fi
+    templates=$(ls -t $WEBTPL |grep 'apache' |grep '\.tpl' |cut -f 2 -d '_'\
+        |cut -f 1 -d  '.')
+    if [ -z "$nohead" ]; then
+        echo "Templates"
+        echo "----------"
+    fi
+    for template in $templates; do
+        echo "$template"
     done
 }
 
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-check_args '1' "$#" 'user'
-validate_format 'user'
-is_object_valid 'user' 'USER' "$user"
-
 
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
 
-# Get user package package
-templates=$(get_user_value '$WEB_TPL')
-
 # Listing domains
 case $format in
     json)   json_list_wtpl ;;

+ 22 - 41
bin/v_list_web_templates_nginx

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: listing nginx templates
-# options: user [format]
+# options: [format]
 #
 # The function for obtaining the list of nginx templates available to a user.
 
@@ -10,66 +10,47 @@
 #----------------------------------------------------------#
 
 # Argument defenition
-user=$1
-format=${2-shell}
+format=${1-shell}
 
 # Includes
 source $VESTA/func/main.sh
 
 # Json function
 json_list_wtpl() {
-    i='1'       # iterator
-    echo '{'
-    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
-        if [ -e "$WEBTPL/ngingx_$template.descr" ]; then
-            descr=$(cat $WEBTPL/ngingx_$template.descr | grep '#'|\
-                sed -e ':a;N;$!ba;s/\n/ /g')
-            if [ $i -ne 1 ]; then
-                echo -e "\t},"
-            fi
-            echo -e  "\t\"$template\": {"
-            echo -e "\t\t\"DESCR\": \"${descr//# /}\""
-            (( ++i))
+    templates=$(ls -t $WEBTPL |grep 'nginx' |grep '\.tpl' |cut -f 2 -d '_'\
+        |cut -f 1 -d  '.')
+    t_counter=$(echo "$templates" | wc -w)
+    i=1
+    echo '['
+    for template in $templates; do
+        if [ "$i" -lt "$t_counter" ]; then
+            echo -e  "\t\"$template\","
+        else
+            echo -e  "\t\"$template\""
         fi
+        (( ++i))
     done
-
-    if [ -n "$template" ]; then
-        echo -e "\t}"
-    fi
-    echo '}'
+    echo "]"
     }
 
 # Shell function
 shell_list_wtpl() {
-    for template in $(echo "$templates" |sed -e "s/,/\n/g"); do
-        if [ -e "$WEBTPL/ngingx_$template.descr" ]; then
-            tpl_descr=$(cat $WEBTPL/ngingx_$template.descr |grep '#')
-            if [ -z "$nohead" ]; then
-                echo "----------"
-            fi
-            echo "TEMPLATE: $template"
-            echo "DESCRIPTION: ${tpl_descr//# /}"
-        fi
+    templates=$(ls -t $WEBTPL |grep 'nginx' |grep '\.tpl' |cut -f 2 -d '_'\
+        |cut -f 1 -d  '.')
+    if [ -z "$nohead" ]; then
+        echo "Templates"
+        echo "----------"
+    fi
+    for template in $templates; do
+        echo "$template"
     done
 }
 
 
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-check_args '1' "$#" 'user'
-validate_format 'user'
-is_object_valid 'user' 'USER' "$user"
-
-
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#
 
-# Get user package package
-templates=$(get_user_value '$WEB_TPL')
-
 # Listing domains
 case $format in
     json)   json_list_wtpl ;;

+ 2 - 2
bin/v_rebuild_web_domains

@@ -185,14 +185,14 @@ for domain in $(shell_list) ; do
 
     # Checking nginx
     if [ ! -z "$NGINX" ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.tpl"
         conf="$HOMEDIR/$user/conf/web/tmp_nginx.conf"
         add_web_config
         chown root:nginx $conf
         chmod 640 $conf
 
         if [ "$SSL" = 'yes' ]; then
-            tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+            tpl_file="$WEBTPL/nginx_$NGINX.stpl"
             conf="$HOMEDIR/$user/conf/web/tmp_snginx.conf"
             add_web_config
             chown root:nginx $conf

+ 2 - 2
bin/v_suspend_web_domain

@@ -63,13 +63,13 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     add_web_config
 
     if [ "$SSL" = 'yes' ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.stpl"
         conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         add_web_config

+ 2 - 2
bin/v_unsuspend_web_domain

@@ -60,13 +60,13 @@ fi
 
 # Checking nginx
 if [ ! -z "$NGINX" ]; then
-    tpl_file="$WEBTPL/ngingx_$NGINX.tpl"
+    tpl_file="$WEBTPL/nginx_$NGINX.tpl"
     conf="$HOMEDIR/$user/conf/web/nginx.conf"
     del_web_config
     add_web_config
 
     if [ "$SSL" = 'yes' ]; then
-        tpl_file="$WEBTPL/ngingx_$NGINX.stpl"
+        tpl_file="$WEBTPL/nginx_$NGINX.stpl"
         conf="$HOMEDIR/$user/conf/web/snginx.conf"
         del_web_config
         add_web_config

+ 1 - 1
data/packages/default.pkg

@@ -1,6 +1,6 @@
+TEMPLATE='default'
 WEB_DOMAINS='100'
 WEB_ALIASES='100'
-WEB_TPL='default,phpfcgid,unlim'
 DNS_DOMAINS='100'
 DNS_RECORDS='100'
 MAIL_DOMAINS='100'

+ 1 - 1
data/packages/gainsboro.pkg

@@ -1,6 +1,6 @@
+TEMPLATE='default'
 WEB_DOMAINS='10'
 WEB_ALIASES='10'
-WEB_TPL='default'
 DNS_DOMAINS='10'
 DNS_RECORDS='10'
 MAIL_DOMAINS='10'

+ 1 - 1
data/packages/palegreen.pkg

@@ -1,6 +1,6 @@
+TEMPLATE='unlim'
 WEB_DOMAINS='50'
 WEB_ALIASES='50'
-WEB_TPL='default'
 DNS_DOMAINS='50'
 DNS_RECORDS='50'
 MAIL_DOMAINS='50'

+ 14 - 0
data/packages/slategrey.pkg

@@ -0,0 +1,14 @@
+TEMPLATE='default'
+WEB_DOMAINS='100'
+WEB_ALIASES='100'
+DNS_DOMAINS='100'
+DNS_RECORDS='100'
+MAIL_DOMAINS='100'
+MAIL_ACCOUNTS='100'
+DATABASES='100'
+CRON_JOBS='100'
+DISK_QUOTA='10000'
+BANDWIDTH='100000'
+NS='ns1.localhost,ns2.localhost'
+SHELL='nologin'
+BACKUPS='3'

+ 36 - 0
data/templates/web/nginx_default.stpl

@@ -0,0 +1,36 @@
+server {
+    listen      %ip%:%proxy_ssl_port%;
+    server_name %domain_idn% %alias_idn%;
+    ssl         on;
+    ssl_certificate      %ssl_pem%;
+    ssl_certificate_key  %ssl_key%;
+    %elog%error_log  /var/log/httpd/domains/%domain%.error.log error;
+
+    location / {
+        proxy_pass      https://%ip%:%web_ssl_port%;
+        location ~* ^.+\.(%nginx_extentions%)$ {
+            root           %sdocroot%;
+            access_log     /var/log/httpd/domains/%domain%.log combined;
+            access_log     /var/log/httpd/domains/%domain%.bytes bytes;
+            expires        max;
+            try_files      $uri @fallback;
+        }
+    }
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location @fallback {
+        proxy_pass      https://%ip%:%web_ssl_port%;
+    }
+
+    location ~ /\.ht    {return 404;}
+    location ~ /\.svn/  {return 404;}
+    location ~ /\.git/  {return 404;}
+    location ~ /\.hg/   {return 404;}
+    location ~ /\.bzr/  {return 404;}
+
+    include %home%/%user%/conf/snginx.%domain%.conf*;
+}
+

+ 33 - 0
data/templates/web/nginx_default.tpl

@@ -0,0 +1,33 @@
+server {
+    listen      %ip%:%proxy_port%;
+    server_name %domain_idn% %alias_idn%;
+    %elog%error_log  /var/log/httpd/domains/%domain%.error.log error;
+
+    location / {
+        proxy_pass      http://%ip%:%web_port%;
+        location ~* ^.+\.(%nginx_extentions%)$ {
+            root           %docroot%;
+            access_log     /var/log/httpd/domains/%domain%.log combined;
+            access_log     /var/log/httpd/domains/%domain%.bytes bytes;
+            expires        max;
+            try_files      $uri @fallback;
+        }
+    }
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location @fallback {
+        proxy_pass      http://%ip%:%web_port%;
+    }
+
+    location ~ /\.ht    {return 404;}
+    location ~ /\.svn/  {return 404;}
+    location ~ /\.git/  {return 404;}
+    location ~ /\.hg/   {return 404;}
+    location ~ /\.bzr/  {return 404;}
+
+    include %home%/%user%/conf/nginx.%domain%.conf*;
+}
+

+ 28 - 18
func/domain.sh

@@ -1,36 +1,46 @@
 # Web template check
 is_apache_template_valid() {
-    c=$(echo "$(get_user_value '$WEB_TPL')" | grep -w  "$template")
     t="$WEBTPL/apache_$template.tpl"
-    d="$WEBTPL/apache_$template.descr"
     s="$WEBTPL/apache_$template.stpl"
-    if [ -z "$c" ] || [ ! -e $t ] || [ ! -e $d ] || [ ! -e $s ]; then
-        echo "Error: template $template not found"
-        log_event "$E_NOTEXIST" "$EVENT"
-        exit $E_NOTEXIST
+    if [ ! -e $t ] || [ ! -e $s ]; then
+        template='default'
+        t="$WEBTPL/apache_$template.tpl"
+        s="$WEBTPL/apache_$template.stpl"
+        if [ ! -e $t ] || [ ! -e $s ]; then
+            echo "Error: template $template not found"
+            log_event "$E_NOTEXIST" "$EVENT"
+            exit $E_NOTEXIST
+        fi
     fi
 }
 
 # Nginx template check
 is_nginx_template_valid() {
-    t="$WEBTPL/ngingx_$template.tpl"
-    d="$WEBTPL/ngingx_$template.descr"
-    s="$WEBTPL/ngingx_$template.stpl"
-    if [ ! -e $t ] || [ ! -e $d ] || [ ! -e $s ]; then
-        echo "Error: nginx $template not found"
-        log_event "$E_NOTEXIST" "$EVENT"
-        exit $E_NOTEXIST
+    t="$WEBTPL/nginx_$template.tpl"
+    s="$WEBTPL/nginx_$template.stpl"
+    if [ ! -e $t ] || [ ! -e $s ]; then
+        template='default'
+        t="$WEBTPL/nginx_$template.tpl"
+        s="$WEBTPL/nginx_$template.stpl"
+        if [ ! -e $t ] || [ ! -e $s ]; then
+            echo "Error: nginx $template not found"
+            log_event "$E_NOTEXIST" "$EVENT"
+            exit $E_NOTEXIST
+        fi
     fi
 }
 
 # DNS template check
 is_dns_template_valid() {
     tpl="$DNSTPL/$template.tpl"
-    descr="$DNSTPL/$template.descr"
-    if [ ! -e $tpl ] || [ ! -e $descr ]; then
-        echo "Error: template not found"
-        log_event "$E_NOTEXIST" "$EVENT"
-        exit $E_NOTEXIST
+    if [ ! -e $tpl ]; then
+        template='default'
+        tpl="$DNSTPL/$template.tpl"
+        if [ ! -e $tpl ]; then
+            echo "Error: template not found"
+            log_event "$E_NOTEXIST" "$EVENT"
+            exit $E_NOTEXIST
+        fi
     fi
 }
 

+ 12 - 4
web/add/dns/index.php

@@ -18,7 +18,6 @@ top_panel($user,$TAB);
         // Check input
         if (empty($_POST['v_domain'])) $errors[] = 'domain';
         if (empty($_POST['v_ip'])) $errors[] = 'ip';
-        if (empty($_POST['v_template'])) $errors[] = 'template';
         if (empty($_POST['v_exp'])) $errors[] = 'expiriation date';
         if (empty($_POST['v_soa'])) $errors[] = 'SOA';
         if (empty($_POST['v_ttl'])) $errors[] = 'TTL';
@@ -27,7 +26,11 @@ top_panel($user,$TAB);
         $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
         $v_domain = escapeshellarg($v_domain);
         $v_ip = escapeshellarg($_POST['v_ip']);
-        $v_template = escapeshellarg($_POST['v_template']);
+        if ($_SESSION['user'] == 'admin') {
+            $v_template = escapeshellarg($_POST['v_template']);
+        } else {
+            $v_template = "''";
+        }
         $v_exp = escapeshellarg($_POST['v_exp']);
         $v_soa = escapeshellarg($_POST['v_soa']);
         $v_ttl = escapeshellarg($_POST['v_ttl']);
@@ -120,8 +123,13 @@ top_panel($user,$TAB);
         $v_ttl = 14400;
         $v_exp = date('Y-m-d', strtotime('+1 year'));
 
-        include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_dns.html');
-        include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
+        if ($_SESSION['user'] == 'admin') {
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_dns.html');
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_dns.html');
+        } else {
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_dns.html');
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_dns.html');
+        }
         unset($_SESSION['error_msg']);
         unset($_SESSION['ok_msg']);
     } else {

+ 12 - 5
web/add/web/index.php

@@ -12,13 +12,10 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
 // Panel
 top_panel($user,$TAB);
 
-// Are you admin?
-//if ($_SESSION['user'] == 'admin') {
     if (!empty($_POST['ok'])) {
         // Check input
         if (empty($_POST['v_domain'])) $errors[] = 'domain';
         if (empty($_POST['v_ip'])) $errors[] = 'ip';
-        if (empty($_POST['v_template'])) $errors[] = 'template';
         if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_crt']))) $errors[] = 'ssl certificate';
         if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))) $errors[] = 'ssl key';
         if ((!empty($_POST['v_aliases'])) || (!empty($_POST['v_elog'])) || (!empty($_POST['v_ssl'])) || (!empty($_POST['v_ssl_crt'])) || (!empty($_POST['v_ssl_key'])) || (!empty($_POST['v_ssl_ca'])) || ($_POST['v_stats'] != 'none') || (empty($_POST['v_nginx']))) $v_adv = 'yes';
@@ -27,7 +24,11 @@ top_panel($user,$TAB);
         $v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
         $v_domain = escapeshellarg($v_domain);
         $v_ip = escapeshellarg($_POST['v_ip']);
-        $v_template = escapeshellarg($_POST['v_template']);
+        if ($_SESSION['user'] == 'admin') {
+            $v_template = escapeshellarg($_POST['v_template']);
+        } else {
+            $v_template = "''";
+        }
         if (empty($_POST['v_dns'])) $v_dns = 'off';
         if (empty($_POST['v_mail'])) $v_mail = 'off';
         if (empty($_POST['v_nginx'])) $v_nginx = 'off';
@@ -204,7 +205,7 @@ top_panel($user,$TAB);
     $ips = json_decode(implode('', $output), true);
     unset($output);
 
-    exec (VESTA_CMD."v_list_web_templates ".$user." json", $output, $return_var);
+    exec (VESTA_CMD."v_list_web_templates json", $output, $return_var);
     $templates = json_decode(implode('', $output), true);
     unset($output);
 
@@ -212,8 +213,14 @@ top_panel($user,$TAB);
     $stats = json_decode(implode('', $output), true);
     unset($output);
 
+// Are you admin?
+if ($_SESSION['user'] == 'admin') {
     include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_web.html');
     include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_web.html');
+} else {
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_web.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/user/add_web.html');
+}
     unset($_SESSION['error_msg']);
     unset($_SESSION['ok_msg']);
 //}

+ 8 - 3
web/edit/dns/index.php

@@ -73,7 +73,7 @@ top_panel($user,$TAB);
             }
 
             // Template
-            if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
+            if (( $_SESSION['user'] == 'admin') && ($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
                 $v_template = escapeshellarg($_POST['v_template']);
                 exec (VESTA_CMD."v_change_dns_domain_tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
                 if ($return_var != 0) {
@@ -139,8 +139,13 @@ top_panel($user,$TAB);
             }
 
         }
-        include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_dns.html');
-        include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns.html');
+        if ($_SESSION['user'] == 'admin') {
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_dns.html');
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns.html');
+        } else {
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_dns.html');
+            include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_dns.html');
+        }
         unset($_SESSION['error_msg']);
         unset($_SESSION['ok_msg']);
     } else {

+ 18 - 1
web/edit/user/index.php

@@ -35,6 +35,7 @@ if ($_SESSION['user'] == 'admin') {
         $v_username = $_GET['user'];
         $v_password = "••••••••";
         $v_email = $data[$v_username]['CONTACT'];
+        $v_template = $data[$v_username]['TEMPLATE'];
         $v_package = $data[$v_username]['PACKAGE'];
         $v_fname = $data[$v_username]['FNAME'];
         $v_lname = $data[$v_username]['LNAME'];
@@ -58,6 +59,10 @@ if ($_SESSION['user'] == 'admin') {
         $packages = json_decode(implode('', $output), true);
         unset($output);
 
+        exec (VESTA_CMD."v_list_web_templates json", $output, $return_var);
+        $templates = json_decode(implode('', $output), true);
+        unset($output);
+
         exec (VESTA_CMD."v_list_sys_shells json", $output, $return_var);
         $shells = json_decode(implode('', $output), true);
         unset($output);
@@ -92,6 +97,18 @@ if ($_SESSION['user'] == 'admin') {
             unset($output);
         }
 
+        // Change template
+        if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
+            $v_template = escapeshellarg($_POST['v_template']);
+            exec (VESTA_CMD."v_change_user_template ".$v_username." ".$v_template, $output, $return_var);
+            if ($return_var != 0) {
+                $error = implode('<br>', $output);
+                if (empty($error)) $error = 'Error: vesta did not return any output.';
+                $_SESSION['error_msg'] = $error;
+            }
+            unset($output);
+        }
+
         // Change shell
         if (($v_shell != $_POST['v_shell']) && (empty($_SESSION['error_msg']))) {
             $v_shell = escapeshellarg($_POST['v_shell']);
@@ -258,7 +275,7 @@ if ($_SESSION['user'] == 'admin') {
             $_SESSION['ok_msg'] = "OK: changes has been saved.";
         }
     }
-    include($_SERVER['DOCUMENT_ROOT'].'/templates/user/menu_edit_user.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_user.html');
     include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html');
     unset($_SESSION['error_msg']);
     unset($_SESSION['ok_msg']);

+ 7 - 2
web/edit/web/index.php

@@ -69,7 +69,7 @@ top_panel($user,$TAB);
         $ips = json_decode(implode('', $output), true);
         unset($output);
 
-        exec (VESTA_CMD."v_list_web_templates ".$user." json", $output, $return_var);
+        exec (VESTA_CMD."v_list_web_templates json", $output, $return_var);
         $templates = json_decode(implode('', $output), true);
         unset($output);
 
@@ -120,7 +120,7 @@ top_panel($user,$TAB);
         }
 
         // Template
-        if (($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
+        if (( $_SESSION['user'] == 'admin') && ($v_template != $_POST['v_template']) && (empty($_SESSION['error_msg']))) {
             $v_template = escapeshellarg($_POST['v_template']);
             exec (VESTA_CMD."v_change_web_domain_tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
             if ($return_var != 0) {
@@ -509,8 +509,13 @@ top_panel($user,$TAB);
         }
 
     }
+if ($_SESSION['user'] == 'admin') {
     include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_web.html');
     include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_web.html');
+} else {
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_web.html');
+    include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_web.html');
+}
     unset($_SESSION['error_msg']);
     unset($_SESSION['ok_msg']);
 //}

+ 15 - 14
web/templates/admin/add_dns.html

@@ -28,22 +28,23 @@
             <tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain;  ?> ></td></tr>
             <tr><td class="add-text" style="padding: 10px 0 0 2px;">IP address</td></tr>
             <tr><td><input type="text" size="20" class="add-input" name="v_ip" <?php if (!empty($v_ip)) echo "value=".$v_ip; ?>></tr>
-            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Template</td></tr>
-            <tr><td><select class="add-list" name="v_template">
-            <?php
-                foreach ($templates as $key => $value) {
-                    echo "\t\t\t\t<option value=\"".$key."\"";
-                    if ((!empty($v_template)) && ( $key == $_POST['v_template'])){
-                        echo ' selected' ;
-                    }
-                    echo ">".$key."</option>\n";
-                }
-            ?>
-                </select></td></tr>
 
             <tr><td class="add-text" style="padding: 10px 0 0 2px;"><a href="javascript:elementHideShow('advtable');" class="add-advanced">Advanced Options ⇢</a></td></tr>
-            <tr><td class="add-text" style="padding: 9px 0 0 0px;">
+            <tr><td class="add-text" style="padding: 10px 0 0 0px;">
                 <table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="advtable">
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">Template</td></tr>
+                    <tr><td><select class="add-list" name="v_template">
+                    <?php
+                        echo "<option value=''></option>";
+                        foreach ($templates as $key => $value) {
+                            echo "\t\t\t\t<option value=\"".$value."\"";
+                            if ((!empty($v_template)) && ( $value == $_POST['v_template'])){
+                                echo ' selected' ;
+                            }
+                            echo ">".$value."</option>\n";
+                        }
+                    ?>
+                        </select></td></tr>
                     <tr><td class="add-text" style="padding: 10px 0 0 2px;">Domain Expiriation</td></tr>
                     <tr><td><input type="text" size="20" class="add-input" name="v_exp" <?php if (!empty($v_exp)) echo "value=".$v_exp; ?>></tr>
                     <tr><td class="add-text" style="padding: 10px 0 0 2px;">SOA</td></tr>
@@ -60,4 +61,4 @@
     </td>
 </tr>
 </table>
-<table class="data-spacer" style="height:9px"><tr><td></td></tr></table>
+<table class="data-spacer" style="height:68px"><tr><td></td></tr></table>

+ 1 - 1
web/templates/admin/add_mail.html

@@ -27,4 +27,4 @@
     </td>
 </tr>
 </table>
-<table class="data-spacer" style="height:19px"><tr><td></td></tr></table>
+<table class="data-spacer" style="height:18px"><tr><td></td></tr></table>

+ 16 - 13
web/templates/admin/add_web.html

@@ -39,18 +39,6 @@
             ?>
                 </select></td></tr>
 
-            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Template</td></tr>
-            <tr><td><select class="add-list" name="v_template">
-            <?php
-                foreach ($templates as $key => $value) {
-                    echo "\t\t\t\t<option value=\"".$key."\"";
-                    if ((!empty($v_template)) && ( $key == $_POST['v_template'])){
-                        echo ' selected' ;
-                    }
-                    echo ">".$key."</option>\n";
-                }
-            ?>
-                </select></td></tr>
             <tr><td class="add-text" style="padding: 10px 0 0 2px;">DNS support</td></tr>
             <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_dns" <?php if (empty($v_dns)) echo "checked=yes"; ?>></tr>
 
@@ -59,8 +47,23 @@
             <tr><td class="add-text" style="padding: 10px 0 0 2px;"><a href="javascript:elementHideShow('advtable');" class="add-advanced">Advanced Options ⇢</a></td></tr>
             <tr><td class="add-text" style="padding: 9px 0 0 0px;">
                 <table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="advtable">
-                    <tr><td class="add-text" style="padding: 0 0 0 2px;">Aliases</td></tr>
+                    <tr><td class="add-text" style="padding: 0 0 0 2px;">Domain Aliases</td></tr>
                     <tr><td><textarea size="20" class="add-textinput" name="v_aliases"><?php if (!empty($v_aliases)) echo $v_aliases;  ?></textarea></td></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">Apache Template</td></tr>
+                    <tr><td><select class="add-list" name="v_template">
+                    <?php
+                        echo "<option value=''></option>";
+                        foreach ($templates as $key => $value) {
+
+                            echo "\t\t\t\t<option value=\"".$value."\"";
+                            if ((!empty($v_template)) && ( $key == $_POST['v_template'])){
+                                echo ' selected' ;
+                            }
+                            echo ">".$value."</option>\n";
+                        }
+                    ?>
+                        </select></td></tr>
+
                     <tr><td class="add-text" style="padding: 10px 0 0 2px;">Error Logging</td></tr>
                     <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_elog" <?php if (!empty($v_elog)) echo "checked=yes" ?>></tr>
                     <tr><td class="add-text" style="padding: 10px 0 0 2px;">Nginx Support</td></tr>

+ 4 - 4
web/templates/admin/edit_dns.html

@@ -21,12 +21,12 @@
             <tr><td><select class="add-list" name="v_template">
             <?php
                 foreach ($templates as $key => $value) {
-                    echo "\t\t\t\t<option value=\"".$key."\"";
-                    $skey = "'".$key."'";
-                    if ((!empty($v_template)) && ( $key == $v_template ) || ($skey == $v_template)){
+                    echo "\t\t\t\t<option value=\"".$value."\"";
+                    $svalue = "'".$value."'";
+                    if ((!empty($v_template)) && ( $value == $v_template ) || ($svalue == $v_template)){
                         echo ' selected' ;
                     }
-                    echo ">".$key."</option>\n";
+                    echo ">".$value."</option>\n";
                 }
             ?>
                 </select></td></tr>

+ 15 - 0
web/templates/admin/edit_user.html

@@ -49,6 +49,21 @@ document.v_edit_user.v_password.value = randomstring;
             <tr><td><input type="text" size="20" class="add-input" name="v_fname" <?php if (!empty($v_fname)) echo "value=".$v_fname; ?>></tr>
             <tr><td class="add-text" style="padding: 10px 0 0 2px;">Last Name</td></tr>
             <tr><td><input type="text" size="20" class="add-input" name="v_lname" <?php if (!empty($v_lname)) echo "value=".$v_lname; ?>></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;" >Default Template:</td></tr>
+            <tr><td><select class="add-list" name="v_template">
+            <?php
+                foreach ($templates as $key => $value) {
+                    echo "\t\t\t\t<option value=\"".$value."\"";
+                    $svalue = "'".$value."'";
+                    if (( $value == $v_template ) || ($svalue == $v_template )){
+                        echo 'selected' ;
+                    }
+
+                    echo ">".$value."</option>\n";
+                }
+            ?>
+                </select></td></tr>
+
             <tr><td class="add-text" style="padding: 10px 0 0 2px;" >Shell</td></tr>
             <tr><td><select class="add-list" name="v_shell">
             <?php

+ 7 - 6
web/templates/admin/edit_web.html

@@ -50,21 +50,22 @@
             ?>
                 </select></td></tr>
 
+            <tr><td class="add-text" style="padding: 10 0 0 2px;">Aliases</td></tr>
+            <tr><td><textarea size="20" class="add-textinput" name="v_aliases"><?php if (!empty($v_aliases)) echo $v_aliases;  ?></textarea></td></tr>
             <tr><td class="add-text" style="padding: 10px 0 0 2px;">Template</td></tr>
             <tr><td><select class="add-list" name="v_template">
             <?php
                 foreach ($templates as $key => $value) {
-                    echo "\t\t\t\t<option value=\"".$key."\"";
-                    $skey = "'".$key."'";
-                    if ((!empty($v_template)) && ( $key == $v_template ) || ($skey == $v_template)){
+                    echo "\t\t\t\t<option value=\"".$value."\"";
+                    $svalue = "'".$value."'";
+                    if ((!empty($v_template)) && ( $value == $v_template ) || ($svalue == $v_template)){
                         echo ' selected' ;
                     }
-                    echo ">".$key."</option>\n";
+                    echo ">".$value."</option>\n";
                 }
             ?>
                 </select></td></tr>
-            <tr><td class="add-text" style="padding: 10 0 0 2px;">Aliases</td></tr>
-            <tr><td><textarea size="20" class="add-textinput" name="v_aliases"><?php if (!empty($v_aliases)) echo $v_aliases;  ?></textarea></td></tr>
+
             <tr><td class="add-text" style="padding: 10px 0 0 2px;">Error Logging</td></tr>
             <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_elog" <?php if ($v_elog == 'yes') echo "checked=yes" ?>></tr>
             <tr><td class="add-text" style="padding: 10px 0 0 2px;">Nginx Support</td></tr>

+ 3 - 3
web/templates/admin/list_user.html

@@ -133,14 +133,14 @@ foreach ($data as $key => $value) {
             </td>
             <td style="vertical-align:top;" width="320">
                 <table width="300">
-                    <tr><td class="counter-name" width="37%">Web Domains:</td>
+                    <tr><td class="counter-name" width="36%">Template:</td>
+                    <td class="counter-value"><?php echo $data[$key]['TEMPLATE'] ?></td></tr>
+                    <tr><td class="counter-name">Web Domains:</td>
                     <td class="counter-value"><?php echo $data[$key]['U_WEB_DOMAINS'] ?> / <?php echo $data[$key]['WEB_DOMAINS'] ?></td></tr>
                     <tr><td class="counter-name">Web SSL:</td>
                     <td class="counter-value"><?php echo $data[$key]['U_WEB_SSL'] ?></td></tr>
                     <tr><td class="counter-name">Web Aliases:</td>
                     <td class="counter-value"><?php echo $data[$key]['WEB_ALIASES'] ?> per domain</td></tr>
-                    <tr><td class="counter-name">Web Templates:</td>
-                    <td class="counter-value"><?php echo str_replace(',', ', ',$data[$key]['WEB_TPL']) ?></td></tr>
                     <tr><td class="counter-name">Dns Domains:</td>
                     <td class="counter-value"><?php echo $data[$key]['U_DNS_DOMAINS'] ?> / <?php echo $data[$key]['DNS_DOMAINS'] ?></td></tr>
                     <tr><td class="counter-name">Dns Records:</td>

+ 0 - 1
web/templates/admin/list_web.html

@@ -121,7 +121,6 @@ foreach ($data as $key => $value) {
                 </td>
                 <td style="vertical-align:top;" width="250">
                     <table>
-                        <tr><td class="counter-name">PHP Type:</td><td class="counter-value"><?php echo $data[$key]['PHP'] ?></td></tr>
                         <tr><td class="counter-name">CGI Support:</td><td class="counter-value"><?php echo $data[$key]['CGI'] ?></td></tr>
                         <tr><td class="counter-name">Error Log:</td><td class="counter-value"><?php echo $data[$key]['ELOG'] ?></td></tr>
                         <tr><td class="counter-name">Web Statistics:</td><td class="counter-value"><?php echo $data[$key]['STATS'] ?></td></tr>

+ 2 - 1
web/templates/login.html

@@ -100,7 +100,8 @@
     .loggin-button:hover {
         background-color: #f0f0f0;
     }
-    button:active {
+
+    .loggin-button:active {
         background-color: #EBE9DC;
     }
     </style>

+ 51 - 0
web/templates/user/add_dns.html

@@ -0,0 +1,51 @@
+<script language="javascript">
+  function elementHideShow(elementToHideOrShow)
+    {
+      var el = document.getElementById(elementToHideOrShow);
+      if (el.style.display == "block") {
+        el.style.display = "none";
+      } else {
+        el.style.display = "block";
+      }
+    }
+</script>
+
+
+<table class='data'>
+<tr class="data-add">
+    <td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
+        <table class="data-col1">
+            <tr><td style="padding: 18 0 4 18;"></td></tr>
+        </table>
+    </td>
+    <td class="data-dotted" width="830px" style="vertical-align:top;">
+        <table width="830px"><tr>
+            <td></td>
+        </tr></table>
+        <table class="data-col2" width="600px">
+            <form method="post" name="v_add_user">
+            <tr><td class="add-text" style="padding: 10 0 0 2px;">Domain</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain;  ?> ></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">IP address</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_ip" <?php if (!empty($v_ip)) echo "value=".$v_ip; ?>></tr>
+
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;"><a href="javascript:elementHideShow('advtable');" class="add-advanced">Advanced Options ⇢</a></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 0px;">
+                <table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="advtable">
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">Domain Expiriation</td></tr>
+                    <tr><td><input type="text" size="20" class="add-input" name="v_exp" <?php if (!empty($v_exp)) echo "value=".$v_exp; ?>></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">SOA</td></tr>
+                    <tr><td><input type="text" size="20" class="add-input" name="v_soa" <?php if (!empty($v_soa)) echo "value=".$v_soa; ?>></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">TTL</td></tr>
+                    <tr><td><input type="text" size="20" class="add-input" name="v_ttl" <?php if (!empty($v_ttl)) echo "value=".$v_ttl; ?>></tr>
+                </table>
+            </td></tr>
+            <tr><td style="padding: 24px 0 0 0;">
+                <input type="submit" name="ok" value="OK" class="add-button"></form>
+                <input type="button" class="add-button" value="Cancel" onClick="location.href='/list/dns/'">
+            </td></tr>
+        </table>
+    </td>
+</tr>
+</table>
+<table class="data-spacer" style="height:68px"><tr><td></td></tr></table>

+ 87 - 0
web/templates/user/add_web.html

@@ -0,0 +1,87 @@
+<script language="javascript">
+  function elementHideShow(elementToHideOrShow)
+    {
+      var el = document.getElementById(elementToHideOrShow);
+      if (el.style.display == "block") {
+        el.style.display = "none";
+      } else {
+        el.style.display = "block";
+      }
+    }
+</script>
+
+
+<table class='data'>
+<tr class="data-add">
+    <td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
+        <table class="data-col1">
+            <tr><td style="padding: 18 0 4 18;"></td></tr>
+        </table>
+    </td>
+    <td class="data-dotted" width="830px" style="vertical-align:top;">
+        <table width="830px"><tr>
+            <td></td>
+        </tr></table>
+        <table class="data-col2" width="600px">
+            <form method="post" name="v_add_user">
+            <tr><td class="add-text" style="padding: 10 0 0 2px;">Domain</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain;  ?> ></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">IP address</td></tr>
+            <tr><td><select class="add-list" name="v_ip">
+            <?php
+                foreach ($ips as $key => $value) {
+                    echo "\t\t\t\t<option value=\"".$key."\"";
+                    if ((!empty($v_ip)) && ( $key == $_POST['v_ip'])){
+                        echo ' selected';
+                    }
+                    echo ">".$key."</option>\n";
+                }
+            ?>
+                </select></td></tr>
+
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">DNS support</td></tr>
+            <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_dns" <?php if (empty($v_dns)) echo "checked=yes"; ?>></tr>
+
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Mail support</td></tr>
+            <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_mail" <?php if (empty($v_mail)) echo "checked=yes"; ?>></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;"><a href="javascript:elementHideShow('advtable');" class="add-advanced">Advanced Options ⇢</a></td></tr>
+            <tr><td class="add-text" style="padding: 9px 0 0 0px;">
+                <table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="advtable">
+                    <tr><td class="add-text" style="padding: 0 0 0 2px;">Domain Aliases</td></tr>
+                    <tr><td><textarea size="20" class="add-textinput" name="v_aliases"><?php if (!empty($v_aliases)) echo $v_aliases;  ?></textarea></td></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">Error Logging</td></tr>
+                    <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_elog" <?php if (!empty($v_elog)) echo "checked=yes" ?>></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">Nginx Support</td></tr>
+                    <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_nginx" <?php if (empty($v_nginx)) echo "checked=yes" ?>></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Support</td></tr>
+                    <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_ssl" <?php if (!empty($v_ssl)) echo "checked=yes" ?>></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Certificate</td></tr>
+                    <tr><td><textarea size="20" class="add-textinput" name="v_ssl_crt"><?php if (!empty($v_ssl_crt)) echo $v_ssl_crt;  ?></textarea></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Key</td></tr>
+                    <tr><td><textarea size="20" class="add-textinput" name="v_ssl_key"><?php if (!empty($v_ssl_key)) echo $v_ssl_key;  ?></textarea></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Certificate Authority <span style="padding:0 0 0 6px; font-size: 10pt; color:#555;">(optional)</span></td></tr>
+                    <tr><td><textarea size="20" class="add-textinput" name="v_ssl_ca"><?php if (!empty($v_ssl_ca)) echo $v_ssl_ca;  ?></textarea></tr>
+                    <tr><td class="add-text" style="padding: 10px 0 0 2px;">Web Statistics</td></tr>
+                    <tr><td><select class="add-list" name="v_stats">
+                    <?php
+                        foreach ($stats as $key => $value) {
+                            $svalue = "'".$value."'";
+                            echo "\t\t\t\t<option value=\"".$value."\"";
+                            if (empty($v_stats)) $v_stats = 'none';
+                            if (( $value == $v_stats ) || ($svalue == $v_stats )){
+                                echo ' selected' ;
+                            }
+                            echo ">".$value."</option>\n";
+                        }
+                    ?>
+                    </select></td></tr>
+                </table>
+            </td></tr>
+            <tr><td style="padding: 24px 0 0 0;">
+                <input type="submit" name="ok" value="OK" class="add-button"></form>
+                <input type="button" class="add-button" value="Cancel" onClick="location.href='/list/web/'">
+            </td></tr>
+        </table>
+    </td>
+</tr>
+</table>

+ 35 - 0
web/templates/user/edit_dns.html

@@ -0,0 +1,35 @@
+<table class='data'>
+<tr class="data-add">
+    <td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
+        <table class="data-col1">
+            <tr><td style="padding: 24px 0 2px 4px;"><a class="data-date" ?><?php echo date("d M Y", strtotime($v_date))?></a></td></tr>
+            <tr><td style="padding: 0 0 6px 4px;"><a class="data-date" ?><?php echo $v_time?></a></td></tr>
+            <tr><td style="padding: 0 0 0 21px;" class="data-<?php echo $v_status ?>"><b><?php echo $v_status ?></b></td></tr>
+        </table>
+    </td>
+    <td class="data-dotted" width="830px" style="vertical-align:top;">
+        <table width="830px"><tr>
+            <td></td>
+        </tr></table>
+        <form method="post" name="v_edit_user">
+        <table class="data-col2" width="830px">
+            <tr><td class="add-text" style="padding: 10 0 0 2px;">Domain</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain;  ?> disabled> <input type="hidden" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain;  ?>></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">IP address</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_ip" <?php if (!empty($v_ip)) echo "value=".$v_ip;  ?>></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Domain Expiriation</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_exp" <?php if (!empty($v_exp)) echo "value=".$v_exp; ?>></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">SOA</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_soa" <?php if (!empty($v_soa)) echo "value=".$v_soa; ?>></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">TTL</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_ttl" <?php if (!empty($v_ttl)) echo "value=".$v_ttl; ?>></tr>
+
+            <tr><td style="padding: 24px 0 0 0;">
+                <input type="submit" class="add-button" name="save" value="Save"></form>
+                <input type="button" class="add-button" value="Cancel" onClick="location.href='/list/dns/'">
+            </td></tr>
+            </form>
+        </table>
+    </td>
+</tr>
+</table>

+ 108 - 0
web/templates/user/edit_web.html

@@ -0,0 +1,108 @@
+<script type="text/javascript">
+  function elementHideShow(elementToHideOrShow)
+    {
+      var el = document.getElementById(elementToHideOrShow);
+      if (el.style.display == "block") {
+        el.style.display = "none";
+      } else {
+        el.style.display = "block";
+      }
+    }
+    function randomString() {
+        var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
+        var string_length = 10;
+        var randomstring = '';
+        for (var i=0; i<string_length; i++) {
+          var rnum = Math.floor(Math.random() * chars.length);
+          randomstring += chars.substring(rnum,rnum+1);
+        }
+        document.getElementById('v_password').value = randomstring;
+    }
+</script>
+<table class='data'>
+<tr class="data-add">
+    <td class="data-dotted" style="padding: 0px 10px 0px 0px" width="150">
+        <table class="data-col1">
+            <tr><td style="padding: 24px 0 2px 4px;"><a class="data-date" ?><?php echo date("d M Y", strtotime($v_date))?></a></td></tr>
+            <tr><td style="padding: 0 0 6px 4px;"><a class="data-date" ?><?php echo $v_time?></a></td></tr>
+            <tr><td style="padding: 0 0 0 21px;" class="data-<?php echo $v_status ?>"><b><?php echo $v_status ?></b></td></tr>
+        </table>
+    </td>
+    <td class="data-dotted" width="830px" style="vertical-align:top;">
+        <table width="830px"><tr>
+            <td></td>
+        </tr></table>
+        <form method="post" name="v_edit_user">
+        <table class="data-col2" width="830px">
+            <tr><td class="add-text" style="padding: 10 0 0 2px;">Domain</td></tr>
+            <tr><td><input type="text" size="20" class="add-input" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain;  ?> disabled> <input type="hidden" name="v_domain" <?php if (!empty($v_domain)) echo "value=".$v_domain;  ?>></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">IP address</td></tr>
+            <tr><td><select class="add-list" name="v_ip">
+            <?php
+                foreach ($ips as $key => $value) {
+                    echo "\t\t\t\t<option value=\"".$key."\"";
+                    $skey = "'".$key."'";
+                    if ((!empty($v_ip)) && ( $key == $v_ip ) || ( $skey == $v_ip )){
+                        echo ' selected';
+                    }
+                    echo ">".$key."</option>\n";
+                }
+            ?>
+                </select></td></tr>
+
+            <tr><td class="add-text" style="padding: 10 0 0 2px;">Aliases</td></tr>
+            <tr><td><textarea size="20" class="add-textinput" name="v_aliases"><?php if (!empty($v_aliases)) echo $v_aliases;  ?></textarea></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Error Logging</td></tr>
+            <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_elog" <?php if ($v_elog == 'yes') echo "checked=yes" ?>></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Nginx Support</td></tr>
+            <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_nginx" <?php if (!empty($v_nginx)) echo "checked=yes" ?> onclick="javascript:elementHideShow('nginxtable');"></tr>
+            <tr><td><table style="display:<?php if (empty($v_nginx)) { echo 'none';} else {echo 'block';}?> ;" id="nginxtable"><tr>
+                <tr><td class="add-text" style="padding: 9px 0 0 2px;">Nginx Supported Extentions</td></tr>
+                <tr><td><textarea size="20" class="add-textinput" name="v_nginx_ext"><?php if (!empty($v_nginx_ext)) { echo $v_nginx_ext;} else { echo 'jpg, jpeg, gif, png, ico, svg, css, zip, tgz, gz, rar, bz2, exe, pdf, doc, xls, ppt, txt, odt, ods, odp, odf, tar, bmp, rtf, js, mp3, avi, mpeg, flv, html, htm'; }  ?></textarea></tr>
+            </td></tr></tr></table></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Support</td></tr>
+            <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_ssl" <?php if ($v_ssl == 'yes') echo "checked=yes" ?> onclick="javascript:elementHideShow('ssltable');"></tr>
+            <tr><td><table style="display:<?php if ($v_ssl == 'no' ) { echo 'none';} else {echo 'block';}?> ;" id="ssltable"><tr>
+                <tr><td class="add-text" style="padding: 9px 0 0 2px;">SSL HomeDirectory</td></tr>
+                <tr><td><select class="add-list" name="v_ssl_home">
+                    <option value='same' <?php if ($v_ssl_home == 'same') echo "selected";?> >public_html</option>
+                    <option value='single' <?php if ($v_ssl_home == 'single') echo "selected";?>>public_shtml</option>
+                </select></td></tr>
+                <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Certificate</td></tr>
+                <tr><td><textarea size="20" class="add-textinput" name="v_ssl_crt"><?php if (!empty($v_ssl_crt)) echo $v_ssl_crt; ?></textarea></td></tr>
+                <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Key</td></tr>
+                <tr><td><textarea size="20" class="add-textinput" name="v_ssl_key"><?php if (!empty($v_ssl_key)) echo $v_ssl_key; ?></textarea></td></tr>
+                <tr><td class="add-text" style="padding: 10px 0 0 2px;">SSL Certificate Authority <span style="padding:0 0 0 6px; font-size: 10pt; color:#555;">(optional)</span></td></tr>
+                <tr><td><textarea size="20" class="add-textinput" name="v_ssl_ca"><?php if (!empty($v_ssl_ca)) echo $v_ssl_ca; ?></textarea></td></tr>
+            </td></tr></tr></table></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Web Statistics</td></tr>
+            <tr><td><select class="add-list" name="v_stats">
+            <?php
+                foreach ($stats as $key => $value) {
+                    $svalue = "'".$value."'";
+                    echo "\t\t\t\t<option value=\"".$value."\"";
+                    if (empty($v_stats)) $v_stats = 'none';
+                    if (( $value == $v_stats ) || ($svalue == $v_stats )){
+                        echo ' selected' ;
+                    }
+                    echo ">".$value."</option>\n";
+                }
+            ?>
+            </select></td></tr>
+            <tr><td class="add-text" style="padding: 10px 0 0 2px;">Web Statistic Authorization</td></tr>
+            <tr><td><input type="checkbox" size="20" class="add-checkbox" name="v_stats_auth" <?php if (!empty($v_stats_user)) echo "checked=yes" ?> onclick="javascript:elementHideShow('statstable');"> </tr>
+            <tr><td><table style="display:<?php if (empty($v_stats_user)) { echo 'none';} else {echo 'block';}?> ;" id="statstable" name="v_add_web_domain_stats_user"><tr>
+                <tr><td class="add-text" style="padding: 9px 0 0 2px;">Web Statistics Username</td></tr>
+                <tr><td><input type="text" size="20" class="add-input" name="v_stats_user" <?php if (!empty($v_stats_user)) echo "value=".$v_stats_user;  ?>></tr>
+                <tr><td class="add-text" style="padding: 10px 0 0 2px;">Web Statistics Password <a href="javascript:randomString();" class="genpass">generate</a></td></tr>
+                <tr><td><input type="text" size="20" class="add-input" name="v_stats_password" <?php if (!empty($v_stats_password)) echo "value=".$v_stats_password;  ?> id="v_password"></tr>
+            </td></tr></tr></table>
+            <tr><td style="padding: 24px 0 0 0;">
+                <input type="submit" class="add-button" name="save" value="Save"></form>
+                <input type="button" class="add-button" value="Cancel" onClick="location.href='/list/web/'">
+            </td></tr>
+            </form>
+        </table>
+    </td>
+</tr>
+</table>

+ 3 - 3
web/templates/user/list_user.html

@@ -89,14 +89,14 @@ foreach ($data as $key => $value) {
             </td>
             <td style="vertical-align:top;" width="320">
                 <table width="300">
-                    <tr><td class="counter-name" width="37%">Web Domains:</td>
+                    <tr><td class="counter-name" width="36%">Predefined Template:</td>
+                    <td class="counter-value"><?php echo $data[$key]['TEMPLATE'] ?></td></tr>
+                    <tr><td class="counter-name">Web Domains:</td>
                     <td class="counter-value"><?php echo $data[$key]['U_WEB_DOMAINS'] ?> / <?php echo $data[$key]['WEB_DOMAINS'] ?></td></tr>
                     <tr><td class="counter-name">Web SSL:</td>
                     <td class="counter-value"><?php echo $data[$key]['U_WEB_SSL'] ?></td></tr>
                     <tr><td class="counter-name">Web Aliases:</td>
                     <td class="counter-value"><?php echo $data[$key]['WEB_ALIASES'] ?> per domain</td></tr>
-                    <tr><td class="counter-name">Web Templates:</td>
-                    <td class="counter-value"><?php echo str_replace(',', ', ',$data[$key]['WEB_TPL']) ?></td></tr>
                     <tr><td class="counter-name">Dns Domains:</td>
                     <td class="counter-value"><?php echo $data[$key]['U_DNS_DOMAINS'] ?> / <?php echo $data[$key]['DNS_DOMAINS'] ?></td></tr>
                     <tr><td class="counter-name">Dns Records:</td>

+ 0 - 1
web/templates/user/list_web.html

@@ -96,7 +96,6 @@ foreach ($data as $key => $value) {
                 </td>
                 <td style="vertical-align:top;" width="250">
                     <table>
-                        <tr><td class="counter-name">PHP Type:</td><td class="counter-value"><?php echo $data[$key]['PHP'] ?></td></tr>
                         <tr><td class="counter-name">CGI Support:</td><td class="counter-value"><?php echo $data[$key]['CGI'] ?></td></tr>
                         <tr><td class="counter-name">Error Log:</td><td class="counter-value"><?php echo $data[$key]['ELOG'] ?></td></tr>
                         <tr><td class="counter-name">Web Statistics:</td><td class="counter-value"><?php echo $data[$key]['STATS'] ?></td></tr>