return &handle_dav_request($davpath);
}
-# Work out the active theme
-local $preroot = $mobile_device && defined($config{'mobile_preroot'}) ?
+# Work out the active theme(s)
+local $preroots = $mobile_device && defined($config{'mobile_preroot'}) ?
$config{'mobile_preroot'} :
$authuser && defined($config{'preroot_'.$authuser}) ?
$config{'preroot_'.$authuser} :
defined($config{'preroot_'.$baseauthuser}) ?
$config{'preroot_'.$baseauthuser} :
$config{'preroot'};
+local @preroots = reverse(split(/\s+/, $preroots));
# Look for the file under the roots
local ($full, @stfull);
-if ($preroot) {
+foreach my $preroot (@preroots) {
# Always under the current webmin root
$preroot =~ s/^.*\///g;
$preroot = $roots[0].'/'.$preroot;
}
$foundroot = undef;
-if ($preroot) {
+foreach my $preroot (@preroots) {
# Look in the theme root directory first
$is_directory = 1;
$sofar = "";
@stfull = stat($full) if (!$foundidx);
}
}
+ last if ($foundroot);
}
print DEBUG "handle_request: initial full=$full\n";
: "";
print "<body bgcolor=#$bgcolor link=#$link vlink=#$link text=#$text ",
"$bgimage $tconfig{'inbody'} $dir $_[8]>\n";
+if (defined(&theme_prebody)) {
+ &theme_prebody(@_);
+ }
local $hostname = &get_display_hostname();
local $version = &get_webmin_version();
local $prebody = $tconfig{'prebody'};
}
close(INC);
}
-if (defined(&theme_prebody)) {
- &theme_prebody(@_);
- }
if (@_ > 1) {
print $tconfig{'preheader'};
print "<table class='header' width=100%><tr>\n";
# For internal use only
sub load_theme_library
{
-return if (!$current_theme || !$tconfig{'functions'} ||
- $loaded_theme_library++);
-do "$theme_root_directory/$tconfig{'functions'}";
+return if (!$current_theme || $loaded_theme_library++);
+for(my $i=0; $i<@theme_root_directories; $i++) {
+ if ($theme_configs[$i]->{'functions'}) {
+ do $theme_root_directories[$i]."/".
+ $theme_configs[$i]->{'functions'};
+ }
+ }
}
# redirect
$main::initial_module_name ||= $module_name;
# Set some useful variables
-$current_theme = $ENV{'MOBILE_DEVICE'} && defined($gconfig{'mobile_theme'}) ?
+local $current_themes;
+$current_themes = $ENV{'MOBILE_DEVICE'} && defined($gconfig{'mobile_theme'}) ?
$gconfig{'mobile_theme'} :
- defined($gconfig{'theme_'.$remote_user}) ?
+ defined($gconfig{'theme_'.$remote_user}) ?
$gconfig{'theme_'.$remote_user} :
- defined($gconfig{'theme_'.$base_remote_user}) ?
+ defined($gconfig{'theme_'.$base_remote_user}) ?
$gconfig{'theme_'.$base_remote_user} :
$gconfig{'theme'};
-if ($current_theme) {
- $theme_root_directory = "$root_directory/$current_theme";
- &read_file_cached("$theme_root_directory/config", \%tconfig);
+@current_themes = split(/\s+/, $current_themes);
+$current_theme = $current_themes[0];
+@theme_root_directories = map { "$root_directory/$_" } @current_themes;
+$theme_root_directory = $theme_root_directories[0];
+@theme_configs = ( );
+foreach my $troot (@theme_root_directories) {
+ local %onetconfig;
+ &read_file_cached("$troot/config", \%onetconfig);
+ &read_file_cached("$troot/config", \%tconfig);
+ push(@theme_configs, \%onetconfig);
}
$tb = defined($tconfig{'cs_header'}) ? "bgcolor=#$tconfig{'cs_header'}" :
defined($gconfig{'cs_header'}) ? "bgcolor=#$gconfig{'cs_header'}" :