#!/usr/local/bin/perl # index.cgi # Display a list of domains managed by this module require './virtual-server-lib.pl'; $vtitle = &text('index_versionmode', $module_info{'version'}, &master_admin() ? $text{'index_mastermode'} : &reseller_admin() ? $text{'index_resellermode'} : $single_domain_mode ? $text{'index_mailmode'} : $text{'index_usermode'}); if ($single_domain_mode) { # This user can edit just a single domain, so show only a menu of # icons for options he can use $d = &get_domain($single_domain_mode); &ui_print_header(&domain_in($d), $text{'index_title2'}, "", undef, 1, 1, 0, undef, undef, undef, $vtitle); @links = ( "list_users.cgi?dom=$single_domain_mode", "list_aliases.cgi?dom=$single_domain_mode", "view_domain.cgi?dom=$single_domain_mode", ); @titles = ( $text{'users_title'}, $text{'aliases_title'}, $text{'view_title'}, ); @icons = ( "images/users.gif", "images/aliases.gif", "images/view.gif" ); &icons_table(\@links, \@titles, \@icons); &ui_print_footer("/", $text{'index'}); exit; } &ui_print_header(undef, $text{'index_title'}, "", "index", 1, 1, 0, undef, undef, undef, $vtitle); # Check if server module configuration has been checked if (&need_config_check() && &can_check_config()) { # Not since last config change .. force it now print &ui_form_start("check.cgi"); print "$text{'index_needcheck'}
\n";
print &ui_submit($text{'index_srefresh'});
print &ui_form_end();
print &ui_form_start("edit_newfeatures.cgi");
print &ui_submit($text{'index_featuresb'});
print &ui_form_end();
print &ui_form_start("edit_newtmpl.cgi");
print &ui_submit($text{'index_tmpls'});
print &ui_form_end();
&ui_print_footer("/", $text{'index'});
exit;
}
# Setup the licence cron job
print &licence_warning_message();
# Display local users
if ($config{'localgroup'} && &can_edit_local()) {
print &ui_subheading($text{'index_header1'});
@lusers = &list_domain_users(undef, 0, 1);
if (@lusers) {
print "",
"$text{'index_uadd'}
\n";
&users_table(\@lusers);
}
else {
print "$text{'index_nousers'}
\n"; } print "", "$text{'index_uadd'}
\n"; print "
\n"; print &ui_form_start("search.cgi"); print "$text{'index_search'}\n"; print &ui_select("field", "dom", [ [ "dom", $text{'index_search_dom'} ], [ "user", $text{'index_search_user'} ], [ "ip", $text{'index_search_ip'} ], [ "parent", $text{'index_search_parent'} ], [ "template", $text{'index_search_template'} ], $virtualmin_pro ? ( [ "reseller", $text{'index_search_reseller'} ] ) : ( ) ]),"\n"; print "$text{'index_contains'}\n"; print &ui_textbox("what", undef, 30),"\n"; print &ui_submit($text{'index_searchok'}); print &ui_form_end(); # Show update/delete all buttons print &ui_form_start("domain_form.cgi"); foreach $d (@doms) { print &ui_hidden("d", $d->{'id'}); } print &ui_submit($text{'index_delete_all'}, "delete"),"\n"; print &ui_submit($text{'index_mass_all'}, "mass"),"\n"; } elsif (@doms) { # Show domains in a table print &ui_form_start("domain_form.cgi"); if ($current_theme ne "virtual-server-theme" && !$main::nocreate_virtualmin_menu) { &create_links(1); } foreach $d (@doms) { $canconfig ||= &can_config_domain($d); } @links = ( ); if ($canconfig && $virtualmin_pro) { push(@links, &select_all_link("d"), &select_invert_link("d")); } print &ui_links_row(\@links); &domains_table(\@doms, $virtualmin_pro); print &ui_links_row(\@links); $shown_table = 1; } else { if (@alldoms) { print "$text{'index_none2'}
\n"; } else { print "$text{'index_none'}
\n"; } print &ui_form_start("domain_form.cgi"); } if ($current_theme ne "virtual-server-theme" && !$main::nocreate_virtualmin_menu) { &create_links(2); } if ($shown_table && $canconfig && $virtualmin_pro) { # Show mass delete / change buttons print &ui_submit($text{'index_delete'}, "delete"),"\n"; print &ui_submit($text{'index_mass'}, "mass"),"\n"; if (&can_disable_domain($doms[0])) { print " \n"; print &ui_submit($text{'index_disable'}, "disable"),"\n"; print &ui_submit($text{'index_enable'}, "enable"),"\n"; } } print &ui_form_end(); print "
\n"; # When using the Virtualmin Pro framed theme, the rest of the page is not needed if ($current_theme eq "virtual-server-theme" || $main::basic_virtualmin_menu) { goto PAGEEND; } # Show icons for editing various global settings if (&can_edit_templates()) { print "
| $text{'index_sfeatures'} | \n"; print join(", ", (map { $text{"feature_".$_} } grep { $config{$_} && $_ ne "unix" && $_ ne "dir" } @features), (map { &plugin_call($_, "feature_name") } @plugins) ); print " |
| $text{'index_snfeatures'} | \n"; print join(", ", map { $text{"feature_".$_} } @dis)," |
| $text{'index_squotas'} | \n"; if (!$config{'quotas'}) { # Quotas manually disabled print "$text{'index_squotas1'}\n"; } elsif ($config{'home_quotas'} && $config{'home_quotas'} eq $config{'mail_quotas'}) { # Both quota filesystems are the same print &text($config{'group_quotas'} ? 'index_squotas5g' : 'index_squotas5', "$config{'home_quotas'}"),"\n"; } elsif ($config{'home_quotas'} && $config{'mail_quotas'}) { # Quota filesystems are different print &text($config{'group_quotas'} ? 'index_squotas4g' : 'index_squotas4', "$config{'home_quotas'}", "$config{'mail_quotas'}"),"\n"; } elsif ($config{'home_quotas'}) { # Only for home print &text($config{'group_quotas'} ? 'index_squotas3g' : 'index_squotas3', "$config{'home_quotas'}"),"\n"; } else { # Not active at all print "$text{'index_squotas2'}\n"; } print " |
| $text{'index_smail'} | \n"; print &mail_system_name(); print " |
| ", &ui_submit($text{'index_srefresh'})," | \n"; print &ui_form_end(),"|
| $info[$i]->[0] | \n"; print "$info[$i]->[1] | \n"; print "
"
: "
");
}
print &ui_buttons_end();
}
}
PAGEEND:
&ui_print_footer("/", $text{'index'});
# create_links(num)
sub create_links
{
local ($dleft, $dreason, $dmax, $dhide) = &count_domains("realdoms");
local ($cannot_add, $limit_reason);
if ($dleft == 0) {
# Need to show reason for hitting the limit
$cannot_add = &text('index_noadd'.$dreason, $dmax);
}
elsif ($dleft != -1 && $_[0] == 1 && !$dhide) {
# Tell the user how close they are to the limit, and why
$limit_reason = &text('index_canadd'.$dreason, $dleft);
}
if (!&can_create_master_servers() && &can_create_sub_servers()) {
# Can just add sub-server
if (!$cannot_add) {
print "$limit_reason\n" if ($limit_reason);
print "\n";
}
elsif ($_[0] == 1) {
print "",$cannot_add,"
\n";
}
}
elsif (&can_create_master_servers()) {
# Can add either master or sub-server
if (!$cannot_add) {
print "$limit_reason
\n" if ($limit_reason);
print "\n";
print "\n";
}
elsif ($_[0] == 1) {
print "",$cannot_add,"
\n";
}
}
if (&can_import_servers()) {
print "\n";
}
if (&can_migrate_servers()) {
print "\n";
}
if ((&can_create_master_servers() || &can_create_sub_servers()) &&
$virtualmin_pro && &can_create_batch()) {
print &ui_submit($text{'index_batch'}, "batch"),"\n";
}
print " \n" if (!$cannot_add);
}