mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-20 21:34:11 -07:00
improved dns nameservers section
This commit is contained in:
parent
d66f30117f
commit
fe71ef2f08
19 changed files with 138 additions and 90 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# info: add dns domain
|
# info: add dns domain
|
||||||
# options: user domain ip [template] [exp] [soa] [ttl]
|
# options: user domain ip [template] [ns1] [ns2] [ns3] [ns4]
|
||||||
#
|
#
|
||||||
# The function adds DNS zone with records defined in the template. If the exp
|
# The function adds DNS zone with records defined in the template. If the exp
|
||||||
# argument isn't stated, the expiration date value will be set to next year.
|
# argument isn't stated, the expiration date value will be set to next year.
|
||||||
|
@ -21,10 +21,11 @@ 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
|
template=$4
|
||||||
next_year=$(date +%F -d "+ 1 year")
|
ns1=$5
|
||||||
exp=${5-$next_year}
|
ns2=$6
|
||||||
soa=$6
|
ns3=$7
|
||||||
ttl=${7-14400}
|
ns4=$8
|
||||||
|
restart=$9
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
|
@ -36,8 +37,8 @@ source $VESTA/func/domain.sh
|
||||||
# Verifications #
|
# Verifications #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
check_args '3' "$#" 'user domain ip [template] [exp] [soa] [ttl]'
|
check_args '3' "$#" 'user domain ip [template] [ns1] [ns2] [ns3] [ns4]'
|
||||||
validate_format 'user' 'domain' 'ip' 'exp' 'ttl'
|
validate_format 'user' 'domain' 'ip'
|
||||||
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"
|
||||||
|
@ -51,23 +52,42 @@ else
|
||||||
is_dns_template_valid
|
is_dns_template_valid
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$ns1" ]; then
|
||||||
|
ns1=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
|
validate_format 'ns1'
|
||||||
|
fi
|
||||||
|
if [ ! -z "$ns2" ]; then
|
||||||
|
ns2=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
|
validate_format 'ns2'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$ns3" ]; then
|
||||||
|
ns3=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
|
validate_format 'ns3'
|
||||||
|
fi
|
||||||
|
if [ ! -z "$ns4" ]; then
|
||||||
|
ns4=$(echo $8 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
|
validate_format 'ns4'
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Defining variables
|
# Defining variables
|
||||||
|
if [ -z $ns2 ]; then
|
||||||
i=1
|
i=1
|
||||||
ns=$(get_user_value '$NS')
|
ns=$(get_user_value '$NS')
|
||||||
for nameserver in ${ns//,/ };do
|
for nameserver in ${ns//,/ };do
|
||||||
eval ns$i=$nameserver
|
eval ns$i=$nameserver
|
||||||
(( ++i))
|
(( ++i))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Define soa
|
|
||||||
if [ -z "$soa" ]; then
|
|
||||||
soa="$ns1"
|
|
||||||
fi
|
fi
|
||||||
|
soa="$ns1"
|
||||||
|
exp=$(date +%F -d "+ 1 year")
|
||||||
|
ttl=14400
|
||||||
|
|
||||||
|
|
||||||
# Adding zone to dns dir
|
# Adding zone to dns dir
|
||||||
cat $DNSTPL/$template.tpl |\
|
cat $DNSTPL/$template.tpl |\
|
||||||
|
@ -78,10 +98,6 @@ cat $DNSTPL/$template.tpl |\
|
||||||
-e "s/%ns2%/$ns2/g" \
|
-e "s/%ns2%/$ns2/g" \
|
||||||
-e "s/%ns3%/$ns3/g" \
|
-e "s/%ns3%/$ns3/g" \
|
||||||
-e "s/%ns4%/$ns4/g" \
|
-e "s/%ns4%/$ns4/g" \
|
||||||
-e "s/%ns5%/$ns5/g" \
|
|
||||||
-e "s/%ns6%/$ns6/g" \
|
|
||||||
-e "s/%ns7%/$ns7/g" \
|
|
||||||
-e "s/%ns8%/$ns8/g" \
|
|
||||||
-e "s/%time%/$TIME/g" \
|
-e "s/%time%/$TIME/g" \
|
||||||
-e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf
|
-e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf
|
||||||
chmod 660 $USER_DATA/dns/$domain.conf
|
chmod 660 $USER_DATA/dns/$domain.conf
|
||||||
|
@ -116,7 +132,9 @@ increase_user_value "$user" '$U_DNS_DOMAINS'
|
||||||
increase_user_value "$user" '$U_DNS_RECORDS' "$records"
|
increase_user_value "$user" '$U_DNS_RECORDS' "$records"
|
||||||
|
|
||||||
# Restart named
|
# Restart named
|
||||||
|
if [ "$restart" != 'no' ]; then
|
||||||
$BIN/v_restart_dns "$EVENT"
|
$BIN/v_restart_dns "$EVENT"
|
||||||
|
fi
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_history "$EVENT"
|
log_history "$EVENT"
|
||||||
|
|
|
@ -18,10 +18,10 @@ 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")
|
||||||
record=$(idn -t --quiet -u "$3" )
|
record=$(idn -t --quiet -u "$3" )
|
||||||
record=$(echo $record | tr '[:upper:]' '[:lower:]')
|
record=$(echo "$record" | tr '[:upper:]' '[:lower:]')
|
||||||
rtype=$(echo "$4"| tr '[:lower:]' '[:upper:]')
|
rtype=$(echo "$4"| tr '[:lower:]' '[:upper:]')
|
||||||
dvalue=$(idn -t --quiet -u "$5" )
|
dvalue=$(idn -t --quiet -u "$5" )
|
||||||
dvalue=$(echo $dvalue | tr '[:upper:]' '[:lower:]')
|
dvalue=$(echo "$dvalue" | tr '[:upper:]' '[:lower:]')
|
||||||
priority=$6
|
priority=$6
|
||||||
id=$7
|
id=$7
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ is_object_unsuspended 'dns' 'DOMAIN' "$domain"
|
||||||
update_object_value 'dns' 'DOMAIN' "$domain" '$EXP' "$exp"
|
update_object_value 'dns' 'DOMAIN' "$domain" '$EXP' "$exp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
|
@ -15,6 +15,7 @@ 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")
|
||||||
soa=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
soa=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
|
restart=$4
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
|
@ -51,7 +52,9 @@ update_domain_zone
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Restart named
|
# Restart named
|
||||||
|
if [ "$restart" != 'no' ]; then
|
||||||
$BIN/v_restart_dns "$EVENT"
|
$BIN/v_restart_dns "$EVENT"
|
||||||
|
fi
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_history "$EVENT"
|
log_history "$EVENT"
|
||||||
|
|
|
@ -63,10 +63,6 @@ cat $DNSTPL/$template.tpl |\
|
||||||
-e "s/%ns2%/$ns2/g" \
|
-e "s/%ns2%/$ns2/g" \
|
||||||
-e "s/%ns3%/$ns3/g" \
|
-e "s/%ns3%/$ns3/g" \
|
||||||
-e "s/%ns4%/$ns4/g" \
|
-e "s/%ns4%/$ns4/g" \
|
||||||
-e "s/%ns5%/$ns5/g" \
|
|
||||||
-e "s/%ns6%/$ns6/g" \
|
|
||||||
-e "s/%ns7%/$ns7/g" \
|
|
||||||
-e "s/%ns8%/$ns8/g" \
|
|
||||||
-e "s/%time%/$TIME/g" \
|
-e "s/%time%/$TIME/g" \
|
||||||
-e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf
|
-e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ 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")
|
||||||
ttl=$3
|
ttl=$3
|
||||||
|
restart=$4
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
|
@ -50,7 +51,9 @@ update_domain_zone
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Restart named
|
# Restart named
|
||||||
|
if [ "$restart" != 'no' ]; then
|
||||||
$BIN/v_restart_dns "$EVENT"
|
$BIN/v_restart_dns "$EVENT"
|
||||||
|
fi
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_history "$EVENT"
|
log_history "$EVENT"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# info: change user nameservers
|
# info: change user nameservers
|
||||||
# options: user ns1 ns2 [ns3] [ns4] [ns5] [ns6] [ns7] [ns8]
|
# options: user ns1 ns2 [ns3] [ns4]
|
||||||
#
|
#
|
||||||
# The function for changing default nameservers for speciefic user.
|
# The function for changing default nameservers for speciefic user.
|
||||||
|
|
||||||
|
@ -15,10 +15,6 @@ ns1=$(echo $2 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
ns2=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
ns2=$(echo $3 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
ns3=$4
|
ns3=$4
|
||||||
ns4=$5
|
ns4=$5
|
||||||
ns5=$6
|
|
||||||
ns6=$7
|
|
||||||
ns7=$8
|
|
||||||
ns8=$9
|
|
||||||
|
|
||||||
# Includes
|
# Includes
|
||||||
source $VESTA/conf/vesta.conf
|
source $VESTA/conf/vesta.conf
|
||||||
|
@ -30,7 +26,7 @@ source $VESTA/func/main.sh
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Checking args
|
# Checking args
|
||||||
check_args '3' "$#" 'user ns1 ns2 [ns3] [ns4] [ns5] [ns6] [ns7] [ns8]'
|
check_args '3' "$#" 'user ns1 ns2 [ns3] [ns4]'
|
||||||
|
|
||||||
# Checking argument format
|
# Checking argument format
|
||||||
validate_format 'user' 'ns1' 'ns2'
|
validate_format 'user' 'ns1' 'ns2'
|
||||||
|
@ -42,22 +38,6 @@ if [ ! -z "$ns4" ]; then
|
||||||
ns4=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
ns4=$(echo $5 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
||||||
validate_format 'ns4'
|
validate_format 'ns4'
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$ns5" ]; then
|
|
||||||
ns5=$(echo $6 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
|
||||||
validate_format 'ns5'
|
|
||||||
fi
|
|
||||||
if [ ! -z "$ns6" ]; then
|
|
||||||
ns6=$(echo $7 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
|
||||||
validate_format 'ns6'
|
|
||||||
fi
|
|
||||||
if [ ! -z "$ns7" ]; then
|
|
||||||
ns7=$(echo $8 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
|
||||||
validate_format 'ns7'
|
|
||||||
fi
|
|
||||||
if [ ! -z "$ns8" ]; then
|
|
||||||
ns8=$(echo $9 | sed -e 's/\.*$//g' -e 's/^\.*//g')
|
|
||||||
validate_format 'ns8'
|
|
||||||
fi
|
|
||||||
|
|
||||||
is_object_valid 'user' 'USER' "$user"
|
is_object_valid 'user' 'USER' "$user"
|
||||||
is_object_unsuspended 'user' 'USER' "$user"
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
|
@ -68,7 +48,7 @@ is_object_unsuspended 'user' 'USER' "$user"
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Merging values
|
# Merging values
|
||||||
ns="$ns1,$ns2,$ns3,$ns4,$ns5,$ns6,$ns7,$ns8"
|
ns="$ns1,$ns2,$ns3,$ns4"
|
||||||
ns=$(echo "$ns"|sed -e "s/,,//g" -e "s/,$//")
|
ns=$(echo "$ns"|sed -e "s/,,//g" -e "s/,$//")
|
||||||
|
|
||||||
# Changing ns values
|
# Changing ns values
|
||||||
|
|
|
@ -42,7 +42,4 @@ echo "$value"
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Logging
|
|
||||||
log_event "$OK" "$EVENT"
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
|
@ -71,10 +71,6 @@ for domain in $(search_objects 'dns' 'DOMAIN' "*" 'DOMAIN'); do
|
||||||
-e "s/%ns2%/$ns2/g" \
|
-e "s/%ns2%/$ns2/g" \
|
||||||
-e "s/%ns3%/$ns3/g" \
|
-e "s/%ns3%/$ns3/g" \
|
||||||
-e "s/%ns4%/$ns4/g" \
|
-e "s/%ns4%/$ns4/g" \
|
||||||
-e "s/%ns5%/$ns5/g" \
|
|
||||||
-e "s/%ns6%/$ns6/g" \
|
|
||||||
-e "s/%ns7%/$ns7/g" \
|
|
||||||
-e "s/%ns8%/$ns8/g" \
|
|
||||||
-e "s/%time%/$TIME/g" \
|
-e "s/%time%/$TIME/g" \
|
||||||
-e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf
|
-e "s/%date%/$DATE/g" > $USER_DATA/dns/$domain.conf
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -734,10 +734,6 @@ validate_format(){
|
||||||
ns2) validate_format_domain "$arg" ;;
|
ns2) validate_format_domain "$arg" ;;
|
||||||
ns3) validate_format_domain "$arg" ;;
|
ns3) validate_format_domain "$arg" ;;
|
||||||
ns4) validate_format_domain "$arg" ;;
|
ns4) validate_format_domain "$arg" ;;
|
||||||
ns5) validate_format_domain "$arg" ;;
|
|
||||||
ns6) validate_format_domain "$arg" ;;
|
|
||||||
ns7) validate_format_domain "$arg" ;;
|
|
||||||
ns8) validate_format_domain "$arg" ;;
|
|
||||||
package) validate_format_username "$arg" "$arg_name" ;;
|
package) validate_format_username "$arg" "$arg_name" ;;
|
||||||
password) validate_format_password "$arg" ;;
|
password) validate_format_password "$arg" ;;
|
||||||
port) validate_format_int "$arg" ;;
|
port) validate_format_int "$arg" ;;
|
||||||
|
|
|
@ -18,9 +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_exp'])) $errors[] = 'expiriation date';
|
|
||||||
if (empty($_POST['v_soa'])) $errors[] = 'SOA';
|
|
||||||
if (empty($_POST['v_ttl'])) $errors[] = 'TTL';
|
|
||||||
|
|
||||||
// Protect input
|
// Protect input
|
||||||
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
$v_domain = preg_replace("/^www./i", "", $_POST['v_domain']);
|
||||||
|
@ -31,9 +28,10 @@ top_panel($user,$TAB);
|
||||||
} else {
|
} else {
|
||||||
$v_template = "''";
|
$v_template = "''";
|
||||||
}
|
}
|
||||||
$v_exp = escapeshellarg($_POST['v_exp']);
|
if (!empty($_POST['v_ns1'])) $v_ns1 = escapeshellarg($_POST['v_ns1']);
|
||||||
$v_soa = escapeshellarg($_POST['v_soa']);
|
if (!empty($_POST['v_ns2'])) $v_ns2 = escapeshellarg($_POST['v_ns2']);
|
||||||
$v_ttl = escapeshellarg($_POST['v_ttl']);
|
if (!empty($_POST['v_ns3'])) $v_ns3 = escapeshellarg($_POST['v_ns3']);
|
||||||
|
if (!empty($_POST['v_ns4'])) $v_ns4 = escapeshellarg($_POST['v_ns4']);
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
if (!empty($errors[0])) {
|
if (!empty($errors[0])) {
|
||||||
|
@ -48,7 +46,7 @@ top_panel($user,$TAB);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Add DNS
|
// Add DNS
|
||||||
exec (VESTA_CMD."v_add_dns_domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_exp." ".$v_soa." ".$v_ttl, $output, $return_var);
|
exec (VESTA_CMD."v_add_dns_domain ".$user." ".$v_domain." ".$v_ip." ".$v_template." ".$v_ns1." ".$v_ns2." ".$v_ns3." ".$ns4, $output, $return_var);
|
||||||
if ($return_var != 0) {
|
if ($return_var != 0) {
|
||||||
$error = implode('<br>', $output);
|
$error = implode('<br>', $output);
|
||||||
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
if (empty($error)) $error = 'Error: vesta did not return any output.';
|
||||||
|
@ -56,6 +54,30 @@ top_panel($user,$TAB);
|
||||||
}
|
}
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
||||||
|
// Change Expiriation date
|
||||||
|
if ((!empty($_POST['v_exp'])) && ($_POST['v_exp'] != date('Y-m-d', strtotime('+1 year')))) {
|
||||||
|
$v_exp = escapeshellarg($_POST['v_exp']);
|
||||||
|
exec (VESTA_CMD."v_change_dns_domain_exp ".$user." ".$v_domain." ".$v_exp, $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 TTL
|
||||||
|
if ((!empty($_POST['v_ttl'])) && ($_POST['v_ttl'] != '14400')) {
|
||||||
|
$v_ttl = escapeshellarg($_POST['v_ttl']);
|
||||||
|
exec (VESTA_CMD."v_change_dns_domain_ttl ".$user." ".$v_domain." ".$v_ttl, $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);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
if (empty($_SESSION['error_msg'])) {
|
||||||
$_SESSION['ok_msg'] = "OK: domain <b>".$_POST[v_domain]."</b> has been created successfully.";
|
$_SESSION['ok_msg'] = "OK: domain <b>".$_POST[v_domain]."</b> has been created successfully.";
|
||||||
unset($v_domain);
|
unset($v_domain);
|
||||||
|
@ -111,17 +133,26 @@ top_panel($user,$TAB);
|
||||||
|
|
||||||
|
|
||||||
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
|
if ((empty($_GET['domain'])) && (empty($_POST['domain']))) {
|
||||||
|
exec (VESTA_CMD."v_get_user_value ".$user." 'TEMPLATE'", $output, $return_var);
|
||||||
|
$template = $output[0] ;
|
||||||
|
unset($output);
|
||||||
|
|
||||||
exec (VESTA_CMD."v_list_dns_templates json", $output, $return_var);
|
exec (VESTA_CMD."v_list_dns_templates json", $output, $return_var);
|
||||||
$templates = json_decode(implode('', $output), true);
|
$templates = json_decode(implode('', $output), true);
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
||||||
|
if ((empty($v_ns1)) && (empty($v_ns2))) {
|
||||||
exec (VESTA_CMD."v_list_user_ns ".$user." json", $output, $return_var);
|
exec (VESTA_CMD."v_list_user_ns ".$user." json", $output, $return_var);
|
||||||
$soa = json_decode(implode('', $output), true);
|
$nameservers = json_decode(implode('', $output), true);
|
||||||
$v_soa = $soa[0];
|
$v_ns1 = $nameservers[0];
|
||||||
|
$v_ns2 = $nameservers[1];
|
||||||
|
$v_ns3 = $nameservers[2];
|
||||||
|
$v_ns4 = $nameservers[3];
|
||||||
unset($output);
|
unset($output);
|
||||||
|
}
|
||||||
|
|
||||||
$v_ttl = 14400;
|
if (empty($v_ttl)) $v_ttl = 14400;
|
||||||
$v_exp = date('Y-m-d', strtotime('+1 year'));
|
if (empty($v_exp)) $v_exp = date('Y-m-d', strtotime('+1 year'));
|
||||||
|
|
||||||
if ($_SESSION['user'] == 'admin') {
|
if ($_SESSION['user'] == 'admin') {
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_dns.html');
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_dns.html');
|
||||||
|
|
|
@ -35,22 +35,30 @@
|
||||||
<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=\"".$value."\"";
|
echo "\t\t\t\t<option value=\"".$value."\"";
|
||||||
if ((!empty($v_template)) && ( $value == $_POST['v_template'])){
|
if ((!empty($v_template)) && ( $value == $_POST['v_template'])){
|
||||||
echo ' selected' ;
|
echo ' selected' ;
|
||||||
}
|
}
|
||||||
|
if ((empty($v_template)) && ( $value == $template)){
|
||||||
|
echo ' selected' ;
|
||||||
|
}
|
||||||
|
|
||||||
echo ">".$value."</option>\n";
|
echo ">".$value."</option>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select></td></tr>
|
</select></td></tr>
|
||||||
<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><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 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><input type="text" size="20" class="add-input" name="v_ttl" <?php if (!empty($v_ttl)) echo "value=".$v_ttl; ?>></tr>
|
||||||
|
<tr><td class="add-text" style="padding: 10px 0 0 2px;">NameServers</td></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns1" <?php if (!empty($v_ns1)) echo "value=".$v_ns1; ?>></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns2" <?php if (!empty($v_ns2)) echo "value=".$v_ns2; ?>></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns3" <?php if (!empty($v_ns3)) echo "value=".$v_ns3; ?>></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns4" <?php if (!empty($v_ns4)) echo "value=".$v_ns4; ?>></tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td style="padding: 24px 0 0 0;">
|
<tr><td style="padding: 24px 0 0 0;">
|
||||||
|
|
|
@ -49,7 +49,7 @@ 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 class="add-text" style="padding: 10px 0 0 2px;" >Default 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) {
|
||||||
|
@ -78,7 +78,7 @@ document.v_edit_user.v_password.value = randomstring;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select></td></tr>
|
</select></td></tr>
|
||||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Name Servers </td></tr>
|
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Default Name Servers </td></tr>
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_ns1" <?php if (!empty($v_ns1)) echo "value=".$v_ns1; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns1" <?php if (!empty($v_ns1)) echo "value=".$v_ns1; ?>></tr>
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_ns2" <?php if (!empty($v_ns2)) echo "value=".$v_ns2; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns2" <?php if (!empty($v_ns2)) echo "value=".$v_ns2; ?>></tr>
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_ns3" <?php if (!empty($v_ns3)) echo "value=".$v_ns3; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns3" <?php if (!empty($v_ns3)) echo "value=".$v_ns3; ?>></tr>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<table class='data'>
|
<table class='data'>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
list($http_host, $port) = split(':', $_SERVER["HTTP_HOST"]);
|
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
++$i;
|
++$i;
|
||||||
if ($data[$key]['SUSPENDED'] == 'yes') {
|
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
list($http_host, $port) = split(':', $_SERVER["HTTP_HOST"]);
|
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
++$i;
|
++$i;
|
||||||
if ($data[$key]['SUSPENDED'] == 'yes') {
|
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||||
|
|
|
@ -32,12 +32,33 @@
|
||||||
<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: 10px 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">
|
<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
|
||||||
|
foreach ($templates as $key => $value) {
|
||||||
|
echo "\t\t\t\t<option value=\"".$value."\"";
|
||||||
|
if ((!empty($v_template)) && ( $value == $_POST['v_template'])){
|
||||||
|
echo ' selected' ;
|
||||||
|
}
|
||||||
|
if ((empty($v_template)) && ( $value == $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 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><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 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><input type="text" size="20" class="add-input" name="v_ttl" <?php if (!empty($v_ttl)) echo "value=".$v_ttl; ?>></tr>
|
||||||
|
<tr><td class="add-text" style="padding: 10px 0 0 2px;">NameServers</td></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns1" <?php if (!empty($v_ns1)) echo "value=".$v_ns1; ?>></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns2" <?php if (!empty($v_ns2)) echo "value=".$v_ns2; ?>></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns3" <?php if (!empty($v_ns3)) echo "value=".$v_ns3; ?>></tr>
|
||||||
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns4" <?php if (!empty($v_ns4)) echo "value=".$v_ns4; ?>></tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td style="padding: 24px 0 0 0;">
|
<tr><td style="padding: 24px 0 0 0;">
|
||||||
|
|
|
@ -32,7 +32,7 @@ document.v_edit_user.v_password.value = randomstring;
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_password" <?php if (!empty($v_password)) echo "value=".$v_password; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_password" <?php if (!empty($v_password)) echo "value=".$v_password; ?>></tr>
|
||||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Email</td></tr>
|
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Email</td></tr>
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_email" <?php if (!empty($v_email)) echo "value=".$v_email; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_email" <?php if (!empty($v_email)) echo "value=".$v_email; ?>></tr>
|
||||||
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Name Servers </td></tr>
|
<tr><td class="add-text" style="padding: 10px 0 0 2px;">Default Name Servers </td></tr>
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_ns1" <?php if (!empty($v_ns1)) echo "value=".$v_ns1; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns1" <?php if (!empty($v_ns1)) echo "value=".$v_ns1; ?>></tr>
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_ns2" <?php if (!empty($v_ns2)) echo "value=".$v_ns2; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns2" <?php if (!empty($v_ns2)) echo "value=".$v_ns2; ?>></tr>
|
||||||
<tr><td><input type="text" size="20" class="add-input" name="v_ns3" <?php if (!empty($v_ns3)) echo "value=".$v_ns3; ?>></tr>
|
<tr><td><input type="text" size="20" class="add-input" name="v_ns3" <?php if (!empty($v_ns3)) echo "value=".$v_ns3; ?>></tr>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<table class='data'>
|
<table class='data'>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
list($http_host, $port) = split(':', $_SERVER["HTTP_HOST"]);
|
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
++$i;
|
++$i;
|
||||||
if ($data[$key]['SUSPENDED'] == 'yes') {
|
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<table class='data'>
|
<table class='data'>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
list($http_host, $port) = split(':', $_SERVER["HTTP_HOST"]);
|
list($http_host, $port) = explode(':', $_SERVER["HTTP_HOST"]);
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
++$i;
|
++$i;
|
||||||
if ($data[$key]['SUSPENDED'] == 'yes') {
|
if ($data[$key]['SUSPENDED'] == 'yes') {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue