mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
record order change functionality
This commit is contained in:
parent
11eef69dda
commit
57c9816135
9 changed files with 107 additions and 0 deletions
67
bin/v-change-dns-domain-record-id
Executable file
67
bin/v-change-dns-domain-record-id
Executable file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: change dns domain record id
|
||||||
|
# options: USER DOMAIN ID NEWID
|
||||||
|
#
|
||||||
|
# The function for changing internal record id.
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Argument defenition
|
||||||
|
user=$1
|
||||||
|
domain=$(idn -t --quiet -u "$2" )
|
||||||
|
domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
|
||||||
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
|
id=$3
|
||||||
|
newid=$4
|
||||||
|
|
||||||
|
# Includes
|
||||||
|
source $VESTA/conf/vesta.conf
|
||||||
|
source $VESTA/func/main.sh
|
||||||
|
source $VESTA/func/domain.sh
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Verifications #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
check_args '4' "$#" 'USER DOMAIN ID NEWID'
|
||||||
|
validate_format 'user' 'domain' 'id' 'newid'
|
||||||
|
is_system_enabled "$DNS_SYSTEM"
|
||||||
|
is_object_valid 'user' 'USER' "$user"
|
||||||
|
is_object_unsuspended 'user' 'USER' "$user"
|
||||||
|
is_object_valid 'dns' 'DOMAIN' "$domain"
|
||||||
|
is_object_unsuspended 'dns' 'DOMAIN' "$domain"
|
||||||
|
is_object_valid "dns/$domain" 'ID' "$id"
|
||||||
|
is_object_new "dns/$domain" 'ID' "$newid"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Action #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Change id
|
||||||
|
sed -i "s/^ID='$id'/ID='$newid'/" $USER_DATA/dns/$domain.conf
|
||||||
|
|
||||||
|
# Sorting records
|
||||||
|
sort_dns_records
|
||||||
|
|
||||||
|
# Updating zone
|
||||||
|
update_domain_zone
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Restart named
|
||||||
|
$BIN/v-restart-dns "$EVENT"
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_history "changed dns record id on $domain"
|
||||||
|
log_event "$OK" "$EVENT"
|
||||||
|
|
||||||
|
exit
|
|
@ -784,6 +784,7 @@ validate_format(){
|
||||||
min) validate_format_mhdmw "$arg" $arg_name ;;
|
min) validate_format_mhdmw "$arg" $arg_name ;;
|
||||||
month) validate_format_mhdmw "$arg" $arg_name ;;
|
month) validate_format_mhdmw "$arg" $arg_name ;;
|
||||||
nat_ip) validate_format_ip "$arg" ;;
|
nat_ip) validate_format_ip "$arg" ;;
|
||||||
|
newid) validate_format_int "$arg" 'id' ;;
|
||||||
ns1) validate_format_domain "$arg" 'name_server';;
|
ns1) validate_format_domain "$arg" 'name_server';;
|
||||||
ns2) validate_format_domain "$arg" 'name_server';;
|
ns2) validate_format_domain "$arg" 'name_server';;
|
||||||
ns3) validate_format_domain "$arg" 'name_server';;
|
ns3) validate_format_domain "$arg" 'name_server';;
|
||||||
|
|
|
@ -195,9 +195,27 @@ if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
|
||||||
$restart_dns = 'yes';
|
$restart_dns = 'yes';
|
||||||
unset($output);
|
unset($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($_GET['record_id'] != $_POST['v_record_id']) && (empty($_SESSION['error_msg']))) {
|
||||||
|
$v_old_record_id = escapeshellarg($_GET['record_id']);
|
||||||
|
exec (VESTA_CMD."v-change-dns-domain-record-id ".$v_username." ".$v_domain." ".$v_old_record_id." ".$v_record_id, $output, $return_var);
|
||||||
|
if ($return_var != 0) {
|
||||||
|
$error = implode('<br>', $output);
|
||||||
|
if (empty($error)) $error = __('Error code:',$return_var);
|
||||||
|
$_SESSION['error_msg'] = $error;
|
||||||
|
}
|
||||||
|
unset($output);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($_SESSION['error_msg'])) {
|
if (empty($_SESSION['error_msg'])) {
|
||||||
$_SESSION['ok_msg'] = __('Changes has been saved.');
|
$_SESSION['ok_msg'] = __('Changes has been saved.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($_GET['record_id'] != $_POST['v_record_id']) {
|
||||||
|
header("Location: /edit/dns/?domain=".$_GET['domain']."&record_id=".$_POST['v_record_id']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html');
|
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_dns_rec.html');
|
||||||
|
|
|
@ -239,6 +239,7 @@ $LANG['en'] = array(
|
||||||
'SSL Key' => 'SSL Key',
|
'SSL Key' => 'SSL Key',
|
||||||
'SSL Certificate Authority / Intermediate' => 'SSL Certificate Authority / Intermediate',
|
'SSL Certificate Authority / Intermediate' => 'SSL Certificate Authority / Intermediate',
|
||||||
'optional' => 'optional',
|
'optional' => 'optional',
|
||||||
|
'internal' => 'internal',
|
||||||
'Statistics Authorization' => 'Statistics Authorization',
|
'Statistics Authorization' => 'Statistics Authorization',
|
||||||
'Statistics Auth' => 'Statistics Auth',
|
'Statistics Auth' => 'Statistics Auth',
|
||||||
'Account' => 'Account',
|
'Account' => 'Account',
|
||||||
|
@ -250,6 +251,7 @@ $LANG['en'] = array(
|
||||||
'Record' => 'Record',
|
'Record' => 'Record',
|
||||||
'IP or Value' => 'IP or Value',
|
'IP or Value' => 'IP or Value',
|
||||||
'Priority' => 'Priority',
|
'Priority' => 'Priority',
|
||||||
|
'Record Number' => 'Record Number',
|
||||||
'in megabytes' => 'in megabytes',
|
'in megabytes' => 'in megabytes',
|
||||||
'Message' => 'Message',
|
'Message' => 'Message',
|
||||||
'use local-part' => 'use local-part',
|
'use local-part' => 'use local-part',
|
||||||
|
|
|
@ -238,6 +238,7 @@ $LANG['es'] = array(
|
||||||
'SSL Key' => 'Llave SSL',
|
'SSL Key' => 'Llave SSL',
|
||||||
'SSL Certificate Authority / Intermediate' => 'Certificado SSL Autoridad / Intermedio',
|
'SSL Certificate Authority / Intermediate' => 'Certificado SSL Autoridad / Intermedio',
|
||||||
'optional' => 'opcional',
|
'optional' => 'opcional',
|
||||||
|
'internal' => 'interno',
|
||||||
'Statistics Authorization' => 'Autorización de Estadísticas',
|
'Statistics Authorization' => 'Autorización de Estadísticas',
|
||||||
'Statistics Auth' => 'Estadística Auth',
|
'Statistics Auth' => 'Estadística Auth',
|
||||||
'Account' => 'Cuenta',
|
'Account' => 'Cuenta',
|
||||||
|
@ -249,6 +250,7 @@ $LANG['es'] = array(
|
||||||
'Record' => 'Registro',
|
'Record' => 'Registro',
|
||||||
'IP or Value' => 'IP o Valor',
|
'IP or Value' => 'IP o Valor',
|
||||||
'Priority' => 'Prioridad',
|
'Priority' => 'Prioridad',
|
||||||
|
'Record Number' => 'Número de registro',
|
||||||
'in megabytes' => 'en megabytes',
|
'in megabytes' => 'en megabytes',
|
||||||
'Message' => 'Mensaje',
|
'Message' => 'Mensaje',
|
||||||
'use local-part' => 'usar parte-local',
|
'use local-part' => 'usar parte-local',
|
||||||
|
|
|
@ -240,6 +240,7 @@ $LANG['ro'] = array(
|
||||||
'SSL Key' => 'Cheia SSL',
|
'SSL Key' => 'Cheia SSL',
|
||||||
'SSL Certificate Authority / Intermediate' => 'SSL Intermediar / Certificate Authority',
|
'SSL Certificate Authority / Intermediate' => 'SSL Intermediar / Certificate Authority',
|
||||||
'optional' => 'opțional',
|
'optional' => 'opțional',
|
||||||
|
'internal' => 'intern',
|
||||||
'Statistics Authorization' => 'Autorizarea statistici',
|
'Statistics Authorization' => 'Autorizarea statistici',
|
||||||
'Statistics Auth' => 'Autorizarea statistici',
|
'Statistics Auth' => 'Autorizarea statistici',
|
||||||
'Account' => 'Cont',
|
'Account' => 'Cont',
|
||||||
|
@ -251,6 +252,7 @@ $LANG['ro'] = array(
|
||||||
'Record' => 'Înregistrare / Subdomeniu',
|
'Record' => 'Înregistrare / Subdomeniu',
|
||||||
'IP or Value' => 'IP adresa sau valoare',
|
'IP or Value' => 'IP adresa sau valoare',
|
||||||
'Priority' => 'Prioritate',
|
'Priority' => 'Prioritate',
|
||||||
|
'Record Number' => 'Numărul de înregistrare',
|
||||||
'in megabytes' => 'în mb.',
|
'in megabytes' => 'în mb.',
|
||||||
'Message' => 'Mesaj',
|
'Message' => 'Mesaj',
|
||||||
'use local-part' => 'doar nume de cont înainte de @',
|
'use local-part' => 'doar nume de cont înainte de @',
|
||||||
|
|
|
@ -240,6 +240,7 @@ $LANG['ru'] = array(
|
||||||
'SSL Key' => 'Ключ SSL сертификата',
|
'SSL Key' => 'Ключ SSL сертификата',
|
||||||
'SSL Certificate Authority / Intermediate' => 'Центр сертификации SSL / Intermediate',
|
'SSL Certificate Authority / Intermediate' => 'Центр сертификации SSL / Intermediate',
|
||||||
'optional' => 'опционально',
|
'optional' => 'опционально',
|
||||||
|
'internal' => 'внутренний',
|
||||||
'Statistics Authorization' => 'Ограниченный доступ к статистике',
|
'Statistics Authorization' => 'Ограниченный доступ к статистике',
|
||||||
'Statistics Auth' => 'Авторизация Статистики',
|
'Statistics Auth' => 'Авторизация Статистики',
|
||||||
'Account' => 'Аккаунт',
|
'Account' => 'Аккаунт',
|
||||||
|
@ -251,6 +252,7 @@ $LANG['ru'] = array(
|
||||||
'Record' => 'Запись / Поддомен',
|
'Record' => 'Запись / Поддомен',
|
||||||
'IP or Value' => 'IP адрес или значение',
|
'IP or Value' => 'IP адрес или значение',
|
||||||
'Priority' => 'Приоритет',
|
'Priority' => 'Приоритет',
|
||||||
|
'Record Number' => 'Порядковый номер',
|
||||||
'in megabytes' => 'в мегабайтах',
|
'in megabytes' => 'в мегабайтах',
|
||||||
'Message' => 'Сообщение',
|
'Message' => 'Сообщение',
|
||||||
'use local-part' => 'используйте только имена аккаунтов',
|
'use local-part' => 'используйте только имена аккаунтов',
|
||||||
|
|
|
@ -240,6 +240,7 @@ $LANG['ua'] = array(
|
||||||
'SSL Key' => 'Ключ SSL сертифікату',
|
'SSL Key' => 'Ключ SSL сертифікату',
|
||||||
'SSL Certificate Authority / Intermediate' => 'Центр сертифікації SSL / Intermediate',
|
'SSL Certificate Authority / Intermediate' => 'Центр сертифікації SSL / Intermediate',
|
||||||
'optional' => 'опційно',
|
'optional' => 'опційно',
|
||||||
|
'internal' => 'внутрішній',
|
||||||
'Statistics Authorization' => 'Обмежений доступ до статистики',
|
'Statistics Authorization' => 'Обмежений доступ до статистики',
|
||||||
'Statistics Auth' => 'Авторизація Статистики',
|
'Statistics Auth' => 'Авторизація Статистики',
|
||||||
'Account' => 'Акаунт',
|
'Account' => 'Акаунт',
|
||||||
|
@ -251,6 +252,7 @@ $LANG['ua'] = array(
|
||||||
'Record' => 'запис / Піддомен',
|
'Record' => 'запис / Піддомен',
|
||||||
'IP or Value' => 'IP адреса або Значення',
|
'IP or Value' => 'IP адреса або Значення',
|
||||||
'Priority' => 'Пріоритет',
|
'Priority' => 'Пріоритет',
|
||||||
|
'Record Number' => 'Порядковий номер',
|
||||||
'in megabytes' => 'в мегабайтах',
|
'in megabytes' => 'в мегабайтах',
|
||||||
'Message' => 'Повідомлення',
|
'Message' => 'Повідомлення',
|
||||||
'use local-part' => 'використовуйте тільки імена акаунтів',
|
'use local-part' => 'використовуйте тільки імена акаунтів',
|
||||||
|
|
|
@ -98,6 +98,17 @@
|
||||||
<input type="text" size="20" class="vst-input" name="v_priority" <?php if (!empty($v_priority)) echo "value=".$v_priority; ?>>
|
<input type="text" size="20" class="vst-input" name="v_priority" <?php if (!empty($v_priority)) echo "value=".$v_priority; ?>>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="vst-text" style="padding: 10px 0 0 2px;">
|
||||||
|
<?php print __('Record Number');?> <span style="padding:0 0 0 6px; font-size: 10pt; color:#555;">(<?php print __('internal');?>)</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input type="text" size="20" class="vst-input" name="v_record_id" <?php if (!empty($v_record_id)) echo "value=".$v_record_id; ?>>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<table class="data-col2">
|
<table class="data-col2">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue