Files
VestaCP/bin/v_get_web_domain_value
2012-01-12 15:03:54 +02:00

63 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# info: get web domain value
# options: user domain key
#
# The function is intended for obtaining a domain value by the key. This call
# is useful for arranging composite queries. The answer is displayed only in
# raw form; output formats aren't supported.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
key=$(echo "$3"| tr '[:lower:]' '[:upper:]'|sed -e "s/^/$/")
# Importing variables
source $VESTA/conf/vars.conf
source $V_CONF/vesta.conf
source $V_FUNC/shared.func
source $V_FUNC/domain.func
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
# Checking args
check_args '3' "$#" 'user domain key'
# Checking argument format
format_validation 'user' 'domain'
# Checking user
is_user_valid
# Checking user is active
is_user_suspended
# Checking domain exist
is_web_domain_valid
# Checking domain is not suspened
is_domain_suspended 'web'
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
value=$(get_web_domain_value "$key")
echo "$value"
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
exit