mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
force_charset is now global
This commit is contained in:
@@ -11,7 +11,6 @@ use WebminCore;
|
||||
@cats = &get_visible_modules_categories();
|
||||
@modules = map { @{$_->{'modules'}} } @cats;
|
||||
|
||||
$charset = defined($force_charset) ? $force_charset : &get_charset();
|
||||
print &popup_header();
|
||||
print <<EOF;
|
||||
<link rel="stylesheet" type="text/css" href="left.css" />
|
||||
|
||||
@@ -3512,5 +3512,34 @@ close(OUTr);
|
||||
return @errs;
|
||||
}
|
||||
|
||||
# get_mail_charset(&mail, &body)
|
||||
# Returns the character set to use for the HTML page for some email
|
||||
sub get_mail_charset
|
||||
{
|
||||
my ($mail, $body) = @_;
|
||||
my $ctype;
|
||||
if ($body) {
|
||||
$ctype = $body->{'header'}->{'content-type'};
|
||||
}
|
||||
$ctype ||= $mail->{'header'}->{'content-type'};
|
||||
if ($ctype =~ /charset="([a-z0-9\-]+)"/i ||
|
||||
$ctype =~ /charset='([a-z0-9\-]+)'/i ||
|
||||
$ctype =~ /charset=([a-z0-9\-]+)/i) {
|
||||
$charset = $1;
|
||||
}
|
||||
}
|
||||
## Special handling of HTML header charset ($force_charset):
|
||||
## For japanese text(ISO-2022-JP/EUC=JP/SJIS), the HTML output and
|
||||
## text contents ($bodycontents) are already converted to EUC,
|
||||
## so overriding HTML charset to that in the mail header ($charset)
|
||||
## is generally wrong. (cf. mailbox/boxes-lib.pl:eucconv())
|
||||
if ( &get_charset() =~ /^EUC/i ) { # EUC-JP,EUC-KR
|
||||
return undef;
|
||||
}
|
||||
else {
|
||||
return $charset;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# View a single email message
|
||||
|
||||
require './mailboxes-lib.pl';
|
||||
$force_charset = '';
|
||||
$main::force_charset = '';
|
||||
&ReadParse();
|
||||
&can_user($in{'user'}) || &error($text{'mail_ecannot'});
|
||||
if (&is_user($in{'user'})) {
|
||||
|
||||
@@ -11,7 +11,7 @@ else {
|
||||
require './view-lib.pl';
|
||||
|
||||
if ($config{'charset'}) {
|
||||
$force_charset = $config{'charset'};
|
||||
$main::force_charset = $config{'charset'};
|
||||
}
|
||||
if ($ENV{'CONTENT_TYPE'} !~ /boundary=/) {
|
||||
&ReadParse();
|
||||
|
||||
@@ -754,7 +754,8 @@ sub header
|
||||
{
|
||||
return if ($main::done_webmin_header++);
|
||||
my $ll;
|
||||
my $charset = defined($force_charset) ? $force_charset : &get_charset();
|
||||
my $charset = defined($main::force_charset) ? $main::force_charset
|
||||
: &get_charset();
|
||||
&PrintHeader($charset);
|
||||
&load_theme_library();
|
||||
if (defined(&theme_header)) {
|
||||
@@ -1019,7 +1020,8 @@ sub popup_header
|
||||
{
|
||||
return if ($main::done_webmin_header++);
|
||||
my $ll;
|
||||
my $charset = defined($force_charset) ? $force_charset : &get_charset();
|
||||
my $charset = defined($main::force_charset) ? $main::force_charset
|
||||
: &get_charset();
|
||||
&PrintHeader($charset);
|
||||
&load_theme_library();
|
||||
if (defined(&theme_popup_header)) {
|
||||
|
||||
Reference in New Issue
Block a user