diff --git a/blue-theme/right.cgi b/blue-theme/right.cgi index ea5b4344a..a239851c8 100755 --- a/blue-theme/right.cgi +++ b/blue-theme/right.cgi @@ -130,22 +130,10 @@ if ($level == 0) { print "\n"; # Check for incorrect OS - if (&foreign_available("webmin")) { + if (&foreign_check("webmin")) { &foreign_require("webmin", "webmin-lib.pl"); - %realos = &webmin::detect_operating_system(undef, 1); - if ($realos{'os_version'} ne $gconfig{'os_version'} || - $realos{'os_type'} ne $gconfig{'os_type'}) { - print "
\n"; - print "

",&webmin::text('os_incorrect', - $realos{'real_os_type'}, - $realos{'real_os_version'}),"

\n"; - print "\n"; - print "

\n"; - print "
\n"; - } + &webmin::show_webmin_notifications(); } - } elsif ($level == 3) { # Show Usermin user's information diff --git a/index.cgi b/index.cgi index f19ec9b78..05f647b08 100755 --- a/index.cgi +++ b/index.cgi @@ -180,20 +180,9 @@ else { } # Check for incorrect OS -if (&foreign_available("webmin")) { +if (&foreign_check("webmin")) { &foreign_require("webmin", "webmin-lib.pl"); - %realos = &webmin::detect_operating_system(undef, 1); - if ($realos{'os_version'} ne $gconfig{'os_version'} || - $realos{'os_type'} ne $gconfig{'os_type'}) { - print "
\n"; - print "

",&webmin::text('os_incorrect', - $realos{'real_os_type'}, - $realos{'real_os_version'}),"

\n"; - print "\n"; - print "

\n"; - print "
\n"; - } + &webmin::show_webmin_notifications(); } if ($miniserv{'logout'} && !$gconfig{'alt_startpage'} && diff --git a/mscstyle3/index.cgi b/mscstyle3/index.cgi index 1471d5284..1ae748f13 100755 --- a/mscstyle3/index.cgi +++ b/mscstyle3/index.cgi @@ -138,21 +138,9 @@ if ($miniserv{'logout'} && !$gconfig{'alt_startpage'} && } # Check for incorrect OS -if (&foreign_available("webmin")) { +if (&foreign_check("webmin")) { &foreign_require("webmin", "webmin-lib.pl"); - %realos = &webmin::detect_operating_system(undef, 1); - if ($realos{'os_version'} ne $gconfig{'os_version'} || - $realos{'os_type'} ne $gconfig{'os_type'}) { - print "
\n"; - print "
  "; - print &webmin::text('os_incorrect', - $realos{'real_os_type'}, - $realos{'real_os_version'}),"\n"; - print "\n"; - print "
\n"; - print "
\n"; - } + &webmin::show_webmin_notifications(); } print $text{'main_footer'}; diff --git a/webmin/webmin-lib.pl b/webmin/webmin-lib.pl index 5f0dfd13a..db6ac7130 100644 --- a/webmin/webmin-lib.pl +++ b/webmin/webmin-lib.pl @@ -829,6 +829,27 @@ $rv{'time'} = time(); return %rv; } +# show_webmin_notifications() +# Print various notifications for the current user, if needed +sub show_webmin_notifications +{ +# Need OS upgrade +local %realos = &detect_operating_system(undef, 1); +if (($realos{'os_version'} ne $gconfig{'os_version'} || + $realos{'os_type'} ne $gconfig{'os_type'}) && + &foreign_available("webmin")) { + print "
\n"; + print &ui_form_start("$gconfig{'webprefix'}/webmin/fix_os.cgi"); + print &text('os_incorrect', $realos{'real_os_type'}, + $realos{'real_os_version'}),"

\n"; + print &ui_form_end([ [ undef, $text{'os_fix'} ] ]); + print "

\n"; + } + +# Password close to expiry +# XXX +} + # get_system_uptime() # Returns the number of seconds the system has been up, or undef if un-available sub get_system_uptime