-
Notifications
You must be signed in to change notification settings - Fork 9
/
list.cgi
executable file
·62 lines (55 loc) · 1.74 KB
/
list.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/local/bin/perl
# Show a list of registered domains accessible to the current user
use strict;
no strict 'refs';
use warnings;
our (%text, %in);
our $module_name;
require './virtualmin-registrar-lib.pl';
&ReadParse();
# Find the domains
my @doms = grep { $_->{$module_name} &&
&virtual_server::can_edit_domain($_) }
&virtual_server::list_domains();
# Get relevant accounts
my @accounts = &list_registrar_accounts();
if ($in{'id'}) {
# Just one account
@accounts = grep { $_->{'id'} eq $in{'id'} } @accounts;
}
&ui_print_header($in{'id'} ? $accounts[0]->{'desc'} : undef,
$text{'list_title'}, "");
# Show each domain, with registration info
my @table;
foreach my $d (@doms) {
my $url = &virtual_server::can_config_domain($d) ?
"../virtual-server/edit_domain.cgi?dom=$d->{'id'}" :
"../virtual-server/view_domain.cgi?dom=$d->{'id'}";
my ($account) = grep { $_->{'id'} eq $d->{'registrar_account'} }
@accounts;
next if (!$account);
my $rfunc = "type_".$account->{'registrar'}."_desc";
my $dname = &virtual_server::show_domain_name($d);
# Get expiry date, if possible
my $efunc = "type_".$account->{'registrar'}."_get_expiry";
my $expiry = undef;
if (defined(&$efunc)) {
(my $ok, $expiry) = &$efunc($account, $d);
$expiry = undef if (!$ok);
}
push(@table, [
"<a href='$url'>$dname</a>",
$account ? ( &$rfunc($account),
$account->{'desc'} )
: ( "None", "None" ),
$d->{'registrar_id'},
$expiry ? &make_date($expiry, 1) : undef,
]);
}
print &ui_columns_table(
[ $text{'list_dom'}, $text{'list_registrar'},
$text{'list_account'}, $text{'list_id'},
$text{'list_expiry'}, ],
100, \@table, undef, 0, undef,
$in{'id'} ? $text{'list_none2'} : $text{'list_none'});
&ui_print_footer("/", $text{'index'});