improved template logic

This commit is contained in:
Serghey Rodin 2012-07-13 23:34:51 +03:00
commit ef33765d31
56 changed files with 710 additions and 282 deletions

View file

@ -19,7 +19,7 @@ domain=$(idn -t --quiet -u "$2" )
domain=$(echo $domain | tr '[:upper:]' '[:lower:]') domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
domain_idn=$(idn -t --quiet -a "$domain") domain_idn=$(idn -t --quiet -a "$domain")
ip=$3 ip=$3
template=${4-default} template=$4
next_year=$(date +%F -d "+ 1 year") next_year=$(date +%F -d "+ 1 year")
exp=${5-$next_year} exp=${5-$next_year}
soa=$6 soa=$6
@ -36,13 +36,19 @@ source $VESTA/func/domain.sh
#----------------------------------------------------------# #----------------------------------------------------------#
check_args '3' "$#" 'user domain ip [template] [exp] [soa] [ttl]' 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_system_enabled "$DNS_SYSTEM"
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user"
is_domain_new 'dns' is_domain_new 'dns'
is_package_full 'DNS_DOMAINS' 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
#----------------------------------------------------------# #----------------------------------------------------------#

View file

@ -20,7 +20,7 @@ domain=$(idn -t --quiet -u "$2" )
domain=$(echo $domain | tr '[:upper:]' '[:lower:]') domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
domain_idn=$(idn -t --quiet -a "$domain") domain_idn=$(idn -t --quiet -a "$domain")
ip=$3 ip=$3
template=${4-default} template=$4
restart=$5 restart=$5
# Includes # Includes
@ -35,7 +35,7 @@ source $VESTA/func/ip.sh
#----------------------------------------------------------# #----------------------------------------------------------#
check_args '3' "$#" 'user domain ip [template] [restart]' 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_system_enabled "$WEB_SYSTEM"
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user"
@ -43,7 +43,13 @@ is_domain_new 'web'
is_ip_valid is_ip_valid
is_ip_avalable is_ip_avalable
is_package_full 'WEB_DOMAINS' 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" docroot="$HOMEDIR/$user/web/$domain/public_html"
conf="$HOMEDIR/$user/conf/web/httpd.conf" conf="$HOMEDIR/$user/conf/web/httpd.conf"
tpl_file="$WEBTPL/apache_$template.tpl" tpl_file="$WEBTPL/apache_$template.tpl"
elog=''
# Parsing template keys cgi=''
template_data=$(cat $WEBTPL/apache_$template.descr|grep -v '#') cgi_option='+ExecCGI'
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
# Adding domain to the httpd.conf # Adding domain to the httpd.conf
add_web_config add_web_config
@ -181,9 +168,9 @@ increase_user_value "$user" '$U_WEB_ALIASES'
# Defining domain variables # Defining domain variables
str="DOMAIN='$domain' IP='$ip' IP6='' ALIAS='$aliases' TPL='$template'" str="DOMAIN='$domain' IP='$ip' IP6='' ALIAS='$aliases' TPL='$template'"
str="$str $template_data SSL='no' SSL_HOME='single' NGINX='' NGINX_EXT=''" str="$str CGI='yes' ELOG='yes' SSL='no' SSL_HOME='single' NGINX=''"
str="$str STATS='' STATS_USER='' STATS_CRYPT='' U_DISK='0' U_BANDWIDTH='0'" str="$str NGINX_EXT='' STATS='' STATS_USER='' STATS_CRYPT='' U_DISK='0'"
str="$str SUSPENDED='no' TIME='$TIME' DATE='$DATE'" str="$str U_BANDWIDTH='0' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
# Registering domain # Registering domain
echo "$str" >> $USER_DATA/web.conf echo "$str" >> $USER_DATA/web.conf

View file

@ -73,13 +73,13 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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
tpl_file="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config

View file

@ -66,13 +66,13 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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
tpl_file="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config

View file

@ -14,7 +14,7 @@
user=$1 user=$1
domain=$(idn -t --quiet -u "$2" ) domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain") 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,\ 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" exe,pdf,ppt,txt,odt,ods,odp,odf,tar,wav,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm"
extentions=${4-$default_extentions} extentions=${4-$default_extentions}
@ -31,14 +31,20 @@ source $VESTA/func/domain.sh
#----------------------------------------------------------# #----------------------------------------------------------#
check_args '2' "$#" 'user domain [template] [extentions] [restart]' 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_system_enabled "$PROXY_SYSTEM"
is_object_valid 'user' 'USER' "$user" is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user" is_object_unsuspended 'user' 'USER' "$user"
is_object_valid 'web' 'DOMAIN' "$domain" is_object_valid 'web' 'DOMAIN' "$domain"
is_object_unsuspended 'web' 'DOMAIN' "$domain" is_object_unsuspended 'web' 'DOMAIN' "$domain"
is_object_value_empty 'web' 'DOMAIN' "$domain" '$NGINX' 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' get_domain_values 'web'
NGINX="$template" NGINX="$template"
NGINX_EXT="$extentions" NGINX_EXT="$extentions"
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" conf="$HOMEDIR/$user/conf/web/nginx.conf"
# Preparing domain values for the template substitution # Preparing domain values for the template substitution
@ -69,7 +75,7 @@ fi
# Checking ssl # Checking ssl
if [ "$SSL" = 'yes' ]; then if [ "$SSL" = 'yes' ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
add_web_config add_web_config

View file

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

View file

@ -163,14 +163,14 @@ then
# Nginx config # Nginx config
if [ ! -z "$NGINX" ] ; then if [ ! -z "$NGINX" ] ; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" 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

View file

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

48
bin/v_change_user_template Executable file
View file

@ -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

View file

@ -60,14 +60,14 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
replace_web_config replace_web_config
fi fi

View file

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

View file

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

View file

@ -61,12 +61,6 @@ fi
upd_web_domain_values upd_web_domain_values
tpl_file="$WEBTPL/apache_$template.tpl" 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 # Checking error log
if [ "$ELOG" = 'no' ]; then if [ "$ELOG" = 'no' ]; then
elog='#' elog='#'
@ -104,13 +98,6 @@ fi
# Changing tpl in config # Changing tpl in config
update_object_value 'web' 'DOMAIN' "$domain" '$TPL' "$template" 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 # Restart web
if [ "$restart" != 'no' ]; then if [ "$restart" != 'no' ]; then
$BIN/v_restart_web "$EVENT" $BIN/v_restart_web "$EVENT"

View file

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

View file

@ -72,13 +72,13 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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
tpl_file="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config

View file

@ -64,13 +64,13 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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
tpl_file="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config

View file

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

View file

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

View file

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

View file

@ -72,7 +72,7 @@ is_object_valid 'user' 'USER' "$user"
conf=$USER_DATA/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 $TEMPLATE $WEB_DOMAINS $WEB_ALIASES
$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 $CRON_JOBS $DISK_QUOTA $BANDWIDTH $NS $SHELL $BACKUPS $CONTACT
$CRON_REPORTS $RKEY $SUSPENDED $SUSPENDED_USERS $SUSPENDED_WEB $CRON_REPORTS $RKEY $SUSPENDED $SUSPENDED_USERS $SUSPENDED_WEB

View file

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

View file

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

View file

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

View file

@ -34,7 +34,7 @@ is_object_valid 'user' 'USER' "$user"
conf=$USER_DATA/web.conf conf=$USER_DATA/web.conf
# Defining fileds to select # 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 \$ELOG \$STATS \$STATS_USER \$SSL \$SSL_HOME \$NGINX"
fields="$fields \$NGINX_EXT \$SUSPENDED \$TIME \$DATE" fields="$fields \$NGINX_EXT \$SUSPENDED \$TIME \$DATE"

View file

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

View file

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

View file

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

View file

@ -63,13 +63,13 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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
tpl_file="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config

View file

@ -60,13 +60,13 @@ fi
# Checking nginx # Checking nginx
if [ ! -z "$NGINX" ]; then if [ ! -z "$NGINX" ]; then
tpl_file="$WEBTPL/ngingx_$NGINX.tpl" tpl_file="$WEBTPL/nginx_$NGINX.tpl"
conf="$HOMEDIR/$user/conf/web/nginx.conf" 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
tpl_file="$WEBTPL/ngingx_$NGINX.stpl" tpl_file="$WEBTPL/nginx_$NGINX.stpl"
conf="$HOMEDIR/$user/conf/web/snginx.conf" conf="$HOMEDIR/$user/conf/web/snginx.conf"
del_web_config del_web_config
add_web_config add_web_config

View file

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

View file

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

View file

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

View file

@ -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'

View file

@ -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*;
}

View file

@ -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*;
}

View file

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

View file

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

View file

@ -12,13 +12,10 @@ include($_SERVER['DOCUMENT_ROOT'].'/templates/header.html');
// Panel // Panel
top_panel($user,$TAB); top_panel($user,$TAB);
// Are you admin?
//if ($_SESSION['user'] == 'admin') {
if (!empty($_POST['ok'])) { if (!empty($_POST['ok'])) {
// Check input // Check input
if (empty($_POST['v_domain'])) $errors[] = 'domain'; if (empty($_POST['v_domain'])) $errors[] = 'domain';
if (empty($_POST['v_ip'])) $errors[] = 'ip'; 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_crt']))) $errors[] = 'ssl certificate';
if ((!empty($_POST['v_ssl'])) && (empty($_POST['v_ssl_key']))) $errors[] = 'ssl key'; 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'; 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 = preg_replace("/^www./i", "", $_POST['v_domain']);
$v_domain = escapeshellarg($v_domain); $v_domain = escapeshellarg($v_domain);
$v_ip = escapeshellarg($_POST['v_ip']); $v_ip = escapeshellarg($_POST['v_ip']);
if ($_SESSION['user'] == 'admin') {
$v_template = escapeshellarg($_POST['v_template']); $v_template = escapeshellarg($_POST['v_template']);
} else {
$v_template = "''";
}
if (empty($_POST['v_dns'])) $v_dns = 'off'; if (empty($_POST['v_dns'])) $v_dns = 'off';
if (empty($_POST['v_mail'])) $v_mail = 'off'; if (empty($_POST['v_mail'])) $v_mail = 'off';
if (empty($_POST['v_nginx'])) $v_nginx = 'off'; if (empty($_POST['v_nginx'])) $v_nginx = 'off';
@ -204,7 +205,7 @@ top_panel($user,$TAB);
$ips = json_decode(implode('', $output), true); $ips = json_decode(implode('', $output), true);
unset($output); 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); $templates = json_decode(implode('', $output), true);
unset($output); unset($output);
@ -212,8 +213,14 @@ top_panel($user,$TAB);
$stats = json_decode(implode('', $output), true); $stats = json_decode(implode('', $output), true);
unset($output); 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/menu_add_web.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/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['error_msg']);
unset($_SESSION['ok_msg']); unset($_SESSION['ok_msg']);
//} //}

View file

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

View file

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

View file

@ -69,7 +69,7 @@ top_panel($user,$TAB);
$ips = json_decode(implode('', $output), true); $ips = json_decode(implode('', $output), true);
unset($output); 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); $templates = json_decode(implode('', $output), true);
unset($output); unset($output);
@ -120,7 +120,7 @@ top_panel($user,$TAB);
} }
// Template // 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']); $v_template = escapeshellarg($_POST['v_template']);
exec (VESTA_CMD."v_change_web_domain_tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var); exec (VESTA_CMD."v_change_web_domain_tpl ".$v_username." ".$v_domain." ".$v_template." 'no'", $output, $return_var);
if ($return_var != 0) { 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/menu_edit_web.html');
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/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['error_msg']);
unset($_SESSION['ok_msg']); unset($_SESSION['ok_msg']);
//} //}

View file

@ -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><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 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><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;">Template</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"> <tr><td><select class="add-list" name="v_template">
<?php <?php
echo "<option value=''></option>";
foreach ($templates as $key => $value) { foreach ($templates as $key => $value) {
echo "\t\t\t\t<option value=\"".$key."\""; echo "\t\t\t\t<option value=\"".$value."\"";
if ((!empty($v_template)) && ( $key == $_POST['v_template'])){ if ((!empty($v_template)) && ( $value == $_POST['v_template'])){
echo ' selected' ; echo ' selected' ;
} }
echo ">".$key."</option>\n"; echo ">".$value."</option>\n";
} }
?> ?>
</select></td></tr> </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;">
<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 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><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 class="add-text" style="padding: 10px 0 0 2px;">SOA</td></tr>
@ -60,4 +61,4 @@
</td> </td>
</tr> </tr>
</table> </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>

View file

@ -27,4 +27,4 @@
</td> </td>
</tr> </tr>
</table> </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>

View file

@ -39,18 +39,6 @@
?> ?>
</select></td></tr> </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 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><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: 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: 9px 0 0 0px;">
<table style="display:<?php if (empty($v_adv)) echo 'none';?> ;" id="advtable"> <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><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 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><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 class="add-text" style="padding: 10px 0 0 2px;">Nginx Support</td></tr>

View file

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

View file

@ -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><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 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><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 class="add-text" style="padding: 10px 0 0 2px;" >Shell</td></tr>
<tr><td><select class="add-list" name="v_shell"> <tr><td><select class="add-list" name="v_shell">
<?php <?php

View file

@ -50,21 +50,22 @@
?> ?>
</select></td></tr> </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 class="add-text" style="padding: 10px 0 0 2px;">Template</td></tr>
<tr><td><select class="add-list" name="v_template"> <tr><td><select class="add-list" name="v_template">
<?php <?php
foreach ($templates as $key => $value) { foreach ($templates as $key => $value) {
echo "\t\t\t\t<option value=\"".$key."\""; echo "\t\t\t\t<option value=\"".$value."\"";
$skey = "'".$key."'"; $svalue = "'".$value."'";
if ((!empty($v_template)) && ( $key == $v_template ) || ($skey == $v_template)){ if ((!empty($v_template)) && ( $value == $v_template ) || ($svalue == $v_template)){
echo ' selected' ; echo ' selected' ;
} }
echo ">".$key."</option>\n"; echo ">".$value."</option>\n";
} }
?> ?>
</select></td></tr> </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 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><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 class="add-text" style="padding: 10px 0 0 2px;">Nginx Support</td></tr>

View file

@ -133,14 +133,14 @@ foreach ($data as $key => $value) {
</td> </td>
<td style="vertical-align:top;" width="320"> <td style="vertical-align:top;" width="320">
<table width="300"> <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> <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> <tr><td class="counter-name">Web SSL:</td>
<td class="counter-value"><?php echo $data[$key]['U_WEB_SSL'] ?></td></tr> <td class="counter-value"><?php echo $data[$key]['U_WEB_SSL'] ?></td></tr>
<tr><td class="counter-name">Web Aliases:</td> <tr><td class="counter-name">Web Aliases:</td>
<td class="counter-value"><?php echo $data[$key]['WEB_ALIASES'] ?> per domain</td></tr> <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> <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> <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> <tr><td class="counter-name">Dns Records:</td>

View file

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

View file

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

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -89,14 +89,14 @@ foreach ($data as $key => $value) {
</td> </td>
<td style="vertical-align:top;" width="320"> <td style="vertical-align:top;" width="320">
<table width="300"> <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> <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> <tr><td class="counter-name">Web SSL:</td>
<td class="counter-value"><?php echo $data[$key]['U_WEB_SSL'] ?></td></tr> <td class="counter-value"><?php echo $data[$key]['U_WEB_SSL'] ?></td></tr>
<tr><td class="counter-name">Web Aliases:</td> <tr><td class="counter-name">Web Aliases:</td>
<td class="counter-value"><?php echo $data[$key]['WEB_ALIASES'] ?> per domain</td></tr> <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> <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> <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> <tr><td class="counter-name">Dns Records:</td>

View file

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