record order change functionality

This commit is contained in:
Serghey Rodin 2013-05-19 15:00:08 +03:00
commit 57c9816135
9 changed files with 107 additions and 0 deletions

View 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

View file

@ -784,6 +784,7 @@ validate_format(){
min) validate_format_mhdmw "$arg" $arg_name ;;
month) validate_format_mhdmw "$arg" $arg_name ;;
nat_ip) validate_format_ip "$arg" ;;
newid) validate_format_int "$arg" 'id' ;;
ns1) validate_format_domain "$arg" 'name_server';;
ns2) validate_format_domain "$arg" 'name_server';;
ns3) validate_format_domain "$arg" 'name_server';;

View file

@ -195,9 +195,27 @@ if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
$restart_dns = 'yes';
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'])) {
$_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');

View file

@ -239,6 +239,7 @@ $LANG['en'] = array(
'SSL Key' => 'SSL Key',
'SSL Certificate Authority / Intermediate' => 'SSL Certificate Authority / Intermediate',
'optional' => 'optional',
'internal' => 'internal',
'Statistics Authorization' => 'Statistics Authorization',
'Statistics Auth' => 'Statistics Auth',
'Account' => 'Account',
@ -250,6 +251,7 @@ $LANG['en'] = array(
'Record' => 'Record',
'IP or Value' => 'IP or Value',
'Priority' => 'Priority',
'Record Number' => 'Record Number',
'in megabytes' => 'in megabytes',
'Message' => 'Message',
'use local-part' => 'use local-part',

View file

@ -238,6 +238,7 @@ $LANG['es'] = array(
'SSL Key' => 'Llave SSL',
'SSL Certificate Authority / Intermediate' => 'Certificado SSL Autoridad / Intermedio',
'optional' => 'opcional',
'internal' => 'interno',
'Statistics Authorization' => 'Autorización de Estadísticas',
'Statistics Auth' => 'Estadística Auth',
'Account' => 'Cuenta',
@ -249,6 +250,7 @@ $LANG['es'] = array(
'Record' => 'Registro',
'IP or Value' => 'IP o Valor',
'Priority' => 'Prioridad',
'Record Number' => 'Número de registro',
'in megabytes' => 'en megabytes',
'Message' => 'Mensaje',
'use local-part' => 'usar parte-local',

View file

@ -240,6 +240,7 @@ $LANG['ro'] = array(
'SSL Key' => 'Cheia SSL',
'SSL Certificate Authority / Intermediate' => 'SSL Intermediar / Certificate Authority',
'optional' => 'opțional',
'internal' => 'intern',
'Statistics Authorization' => 'Autorizarea statistici',
'Statistics Auth' => 'Autorizarea statistici',
'Account' => 'Cont',
@ -251,6 +252,7 @@ $LANG['ro'] = array(
'Record' => 'Înregistrare / Subdomeniu',
'IP or Value' => 'IP adresa sau valoare',
'Priority' => 'Prioritate',
'Record Number' => 'Numărul de înregistrare',
'in megabytes' => 'în mb.',
'Message' => 'Mesaj',
'use local-part' => 'doar nume de cont înainte de @',

View file

@ -240,6 +240,7 @@ $LANG['ru'] = array(
'SSL Key' => 'Ключ SSL сертификата',
'SSL Certificate Authority / Intermediate' => 'Центр сертификации SSL / Intermediate',
'optional' => 'опционально',
'internal' => 'внутренний',
'Statistics Authorization' => 'Ограниченный доступ к статистике',
'Statistics Auth' => 'Авторизация Статистики',
'Account' => 'Аккаунт',
@ -251,6 +252,7 @@ $LANG['ru'] = array(
'Record' => 'Запись / Поддомен',
'IP or Value' => 'IP адрес или значение',
'Priority' => 'Приоритет',
'Record Number' => 'Порядковый номер',
'in megabytes' => 'в мегабайтах',
'Message' => 'Сообщение',
'use local-part' => 'используйте только имена аккаунтов',

View file

@ -240,6 +240,7 @@ $LANG['ua'] = array(
'SSL Key' => 'Ключ SSL сертифікату',
'SSL Certificate Authority / Intermediate' => 'Центр сертифікації SSL / Intermediate',
'optional' => 'опційно',
'internal' => 'внутрішній',
'Statistics Authorization' => 'Обмежений доступ до статистики',
'Statistics Auth' => 'Авторизація Статистики',
'Account' => 'Акаунт',
@ -251,6 +252,7 @@ $LANG['ua'] = array(
'Record' => 'запис / Піддомен',
'IP or Value' => 'IP адреса або Значення',
'Priority' => 'Пріоритет',
'Record Number' => 'Порядковий номер',
'in megabytes' => 'в мегабайтах',
'Message' => 'Повідомлення',
'use local-part' => 'використовуйте тільки імена акаунтів',

View file

@ -98,6 +98,17 @@
<input type="text" size="20" class="vst-input" name="v_priority" <?php if (!empty($v_priority)) echo "value=".$v_priority; ?>>
</td>
</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 class="data-col2">
<tr>