-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.cgi
executable file
·65 lines (60 loc) · 1.77 KB
/
index.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
63
64
#!/usr/local/bin/perl
# Show domains that have analytics enabled
use strict;
use warnings;
our %text;
our $module_name;
our @tracking_services;
require './virtualmin-google-analytics-lib.pl';
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
my @doms = grep { &virtual_server::can_edit_domain($_) && !$_->{'alias'} }
&virtual_server::list_domains();
no warnings "once"; # XXX sniffy.
if (!@doms) {
# User has no domains
print "<b>$text{'index_nodoms'}</b>\n";
}
elsif (&indexof($module_name, @virtual_server::confplugins) < 0) {
# Plugin is not enabled
print "<b>",&text('index_eplugin',
"../virtual-server/edit_newfeatures.cgi"),"</b><p>\n";
}
else {
# Make table rows
my @table;
foreach my $d (@doms) {
my $has = &has_analytics_directives($d);
my @accounts;
if ($has) {
# Find all tracking services
foreach my $s (@tracking_services) {
my $a = &{$s->[1]}($d);
if ($a) {
push(@accounts,
&text('index_'.$s->[0], $a));
}
}
}
my @actions;
push(@actions, "<a href='edit.cgi?dom=$d->{'id'}'>".
"$text{'index_edit'}</a>") if ($has);
my $prog = &virtual_server::can_config_domain($d) ?
"edit_domain.cgi" : "view_domain.cgi";
my $dname = defined(&virtual_server::show_domain_name) ?
&virtual_server::show_domain_name($d) : $d->{'dom'};
push(@table, [
"<a href='../virtual-server/$prog?dom=$d->{'id'}'>".
"$dname</a>",
@accounts ? join("<br>", @accounts) :
$has ? $text{'index_has'} : $text{'index_dis'},
&ui_links_row(\@actions)
]);
}
# Render the table
print $text{'index_desc'},"<p>\n";
print &ui_columns_table(
[ $text{'index_dom'}, $text{'index_status'}, $text{'index_actions'} ],
100, \@table, undef, 1);
}
use warnings "once";
&ui_print_footer("/", $text{'index'});