forked from virtualmin/virtualmin-registrar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_contact.cgi
executable file
·48 lines (40 loc) · 1.42 KB
/
view_contact.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/local/bin/perl
# Show contact details for some domain
use strict;
no strict 'refs';
use warnings;
our (%text, %in);
require './virtualmin-registrar-lib.pl';
&ReadParse();
&error_setup($text{'contact_err'});
# Get the Virtualmin domain
&can_domain($in{'dom'}) || &error($text{'contact_ecannot'});
my $d = &virtual_server::get_domain_by("dom", $in{'dom'});
$d || &error(&text('contact_edom', $in{'dom'}));
&can_contacts($d) || &error(&text('contact_edom', $in{'dom'}));
my ($account) = grep { $_->{'id'} eq $d->{'registrar_account'} }
&list_registrar_accounts();
$account || &error(&text('contact_eaccount', $in{'dom'}));
# Get contact info from registrar
my $cfunc = "type_".$account->{'registrar'}."_get_contact";
my $cons = &$cfunc($account, $d);
ref($cons) || &error($cons);
&ui_print_header(&virtual_server::domain_in($d), $text{'contact_title2'}, "");
# Show fields for each contact type
foreach my $con (@$cons) {
print &ui_hidden_table_start($text{'contact_header_'.
lc($con->{'purpose'})},
"width=100%", 2, $con->{'type'}, 1,
[ "width=30%" ]);
my @schema = &get_contact_schema($account, $d, $con->{'type'});
foreach my $s (@schema) {
my $v = $con->{$s->{'name'}};
if ($s->{'choices'}) {
my ($ch) = grep { $_->[0] eq $v } @{$s->{'choices'}};
$v = $ch->[1] if ($ch);
}
print &ui_table_row($text{'contact_'.lc($s->{'name'})}, $v);
}
print &ui_hidden_table_end();
}
&ui_print_footer();