version 1.222, 2009/02/05 00:45:29
|
version 1.222.2.2, 2010/09/13 23:38:04
|
Line 203 use Apache::lonnet;
|
Line 203 use Apache::lonnet;
|
use HTML::TokeParser(); |
use HTML::TokeParser(); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Mail::Send; |
use Mail::Send; |
|
use HTML::Entities; |
|
use Encode; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
{ |
{ |
Line 484 sub sendnotification {
|
Line 486 sub sendnotification {
|
my $protocol = $Apache::lonnet::protocol{$homeserver}; |
my $protocol = $Apache::lonnet::protocol{$homeserver}; |
$protocol = 'http' if ($protocol ne 'https'); |
$protocol = 'http' if ($protocol ne 'https'); |
my $url = $protocol.'://'.&Apache::lonnet::hostname($homeserver). |
my $url = $protocol.'://'.&Apache::lonnet::hostname($homeserver). |
'/adm/email?username='.$touname.'&domain='.$toudom; |
'/adm/email?username='.$touname.'&domain='.$toudom. |
|
'&display='.&escape($msgid); |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid, |
my ($sendtime,$shortsubj,$fromname,$fromdomain,$status,$fromcid, |
$symb,$error) = &Apache::lonmsg::unpackmsgid($msgid); |
$symb,$error) = &Apache::lonmsg::unpackmsgid($msgid); |
my ($coursetext,$body,$bodybegin,$bodysubj,$bodyend); |
my ($coursetext,$body,$bodybegin,$bodysubj,$bodyend); |
Line 537 to access the full message.',$url);
|
Line 540 to access the full message.',$url);
|
} |
} |
if ($userenv{'notifywithhtml'} ne '') { |
if ($userenv{'notifywithhtml'} ne '') { |
my @htmlexcerpt = split(/,/,$userenv{'notifywithhtml'}); |
my @htmlexcerpt = split(/,/,$userenv{'notifywithhtml'}); |
|
my $htmlfree = &make_htmlfree($text); |
foreach my $addr (@recipients) { |
foreach my $addr (@recipients) { |
if ($blocked) { |
if ($blocked) { |
$body = $bodybegin."\n".$blocktext."\n".$bodyend; |
$body = $bodybegin."\n".$blocktext."\n".$bodyend; |
} else { |
} else { |
my $sendtext = $text; |
my $sendtext; |
if (!grep/^\Q$addr\E/,@htmlexcerpt) { |
if (!grep/^\Q$addr\E/,@htmlexcerpt) { |
$sendtext =~ s/\<\/*[^\>]+\>//gs; |
$sendtext = $htmlfree; |
|
} else { |
|
$sendtext = $text; |
} |
} |
$body = $bodybegin.$bodysubj.$sendtext.$bodyend; |
$body = $bodybegin.$bodysubj.$sendtext.$bodyend; |
} |
} |
Line 553 to access the full message.',$url);
|
Line 559 to access the full message.',$url);
|
if ($blocked) { |
if ($blocked) { |
$body = $bodybegin."\n".$blocktext."\n".$bodyend; |
$body = $bodybegin."\n".$blocktext."\n".$bodyend; |
} else { |
} else { |
$text =~ s/\<\/*[^\>]+\>//gs; |
my $htmlfree = &make_htmlfree($text); |
$body = $bodybegin.$bodysubj.$text.$bodyend; |
$body = $bodybegin.$bodysubj.$htmlfree.$bodyend; |
} |
} |
&sendemail($to,$subject,$body,$touname,$toudom,$user_lh); |
&sendemail($to,$subject,$body,$touname,$toudom,$user_lh); |
} |
} |
} |
} |
|
|
|
sub make_htmlfree { |
|
my ($text) = @_; |
|
$text =~ s/\<\/*[^\>]+\>//gs; |
|
$text = &HTML::Entities::decode($text); |
|
$text = &Encode::encode('utf8',$text); |
|
return $text; |
|
} |
|
|
sub newmail { |
sub newmail { |
if ((time-$env{'user.mailcheck.time'})>300) { |
if ((time-$env{'user.mailcheck.time'})>300) { |