Commit f42ead60 authored by sikeda's avatar sikeda
Browse files

[bug][#6987] [Reported by D. Pritts, Internet2] Changing...

[bug][#6987] [Reported by D. Pritts, Internet2] Changing web_archive_spam_protection did not update spam protection mode on past archives.  Fixed by applying spam protection at the time of display, not when archives were created / rebuilt.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12690 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 483953ba
......@@ -29,7 +29,7 @@
[% IF dark == '1' %]<tr>[% SET dark = '0' %][% ELSE %]<tr class="color0">[% SET dark = '1' %][% END %]
<td headers="list_name">
<a href="[% path_cgi %]/info/[% l.name %]" ><strong>[% hidden_head %][% l.name %][% hidden_at %][% l.host %][% hidden_end %]</strong></a>
<a href="[% path_cgi %]/info/[% l.name %]" ><strong>[%|obfuscate(conf.spam_protection) %][% l.name %]@[% l.host %][% END %]</strong></a>
</td>
<td class="text_center" headers="message"> [% l.msg_count %] </td>
<td class="text_center" headers="average"> [% l.average %] </td>
......
<!-- $Id$ -->
<!-- begin : this part is generated by mhonarc using mhonarc-ressources.tt2 -->
<div class="block">
<h2>[%|loc%]List archive[%END%] <a href="[% path_cgi %]/nomenu/help/arc" title="[%|loc%]Open in a new window[%END%]" onclick="window.open('','wws_help','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=400,height=200')" target="wws_help"><i class="fa fa-question-circle" title="[%|loc%]Help[%END%]"></i></a></h2>
<br />
<!-- part generated by mhonarc -->
[% IF html_content ~%]
[% TRY ~%]
[% html_content | eval %]
[% html_content | eval | obfuscate(listconf.web_archive_spam_protection) %]
[%~ CATCH ~%]
<!-- [% error | html %] -->
[%~ END ~%]
[%~ END ~%]
[% END %]
</div>
<!-- end of part generated by mhonarc -->
</div>
<!-- end arc.tt2 -->
......@@ -30,7 +30,7 @@
<tr class="color0">[% SET dark = 1 %]
[% END %]
<td>
<a href="[% path_cgi %]/info/[% l.name %]" ><strong>[% hidden_head %][% l.name %][% hidden_at %][% l.host %][% hidden_end %]</strong></a>
<a href="[% path_cgi %]/info/[% l.name %]" ><strong>[%|obfuscate(conf.spam_protection) %][% l.name %]@[% l.host %][% END %]</strong></a>
</td>
<td> [% l.date %] </td>
......
......@@ -91,11 +91,7 @@
[% END %]
<li>
[% IF protection_type == 'javascript' %]
[% hidden_head %]<a href=\"mailto:[% list %]-request[% hidden_at %][% domain %]\">[%|loc%]Contact owners[%END%]</a>[% hidden_end %]
[% ELSE %]
<a href="mailto:[% hidden_head %][% list %]-request[% hidden_at %][% domain %][% hidden_end %]">[%|loc%]Contact owners[%END%]</a>
[% END %]
[%|obfuscate(listconf.spam_protection) %]<a href="mailto:[% list %]-request@[% domain %]">[%|loc%]Contact owners[%END%]</a>[% END %]
</li>
<!-- end list_panel.tt2 -->
......@@ -24,7 +24,7 @@
<ul class="listenum">
[% FOREACH listname IN orderedlist.$letter %]
<li class="listenum">
<a href="[% path_cgi %]/info/[% listname %]">[% hidden_head %][% listname %][% hidden_at %][% which.$listname.host %][% hidden_end %]
<a href="[% path_cgi %]/info/[% listname %]">[%|obfuscate(conf.spam_protection) %][% listname %]@[% which.$listname.host %][% END %]
[% IF which.$listname.is_owner || which.$listname.is_editor || which.$listname.is_subscriber ~%]
<span class="highlighted">(
[%~ IF which.$listname.is_owner ~%]
......
......@@ -15,7 +15,7 @@
<div class="item[% additional_class %]">
<div class="item_content">
<a class="item_title" href="[% path_cgi %]/info/[% l.key %]">
[% hidden_head %][% l.key %][% hidden_end %]
[%|obfuscate(conf.spam_protection) %][% l.key %][% END %]
[% IF l.value.is_owner || l.value.is_editor || l.value.is_subscriber ~%]
<span class="highlighted">(
[%~ IF l.value.is_owner ~%]
......
......@@ -29,7 +29,7 @@
<tr class="color0">
[% END %]
<td>
<a href="[% path_cgi %]/info/[% l.key %]" ><strong>[% hidden_head %][% l.key %][% hidden_at %][% l.value.host %][% hidden_end %]</strong></a>
<a href="[% path_cgi %]/info/[% l.key %]" ><strong>[%|obfuscate(conf.spam_protection) %][% l.key %]@[% l.value.host %][% END %]</strong></a>
</td>
<td>
[% IF l.value.is_member %][%|loc%]member[%END%] [% END %]
......
......@@ -25,7 +25,7 @@
<div class="item[% additional_class %]">
<div class="item_content">
<a class="item_title" href="[% path_cgi %]/info/[% l.key %]">
[% hidden_head %][% l.key %][% hidden_end %]
[%|obfuscate(conf.spam_protection) %][% l.key %][% END %]
[% IF l.value.admin %]
<span class="highlighted">([%|loc%]Owner[%END%])</span>
[% END %]
......
......@@ -23,7 +23,7 @@
[% IF l.value.admin %]<a class="actionMenuLinks" href="[% path_cgi %]/admin/[% l.key %]" >
[%|loc%]admin[%END%]</a>[% END %]
<a class="list_menu_links" href="[% path_cgi %]/info/[% l.key %]" >
[% hidden_head %][% l.key %][% hidden_end %]</a><br />
[%|obfuscate(conf.spam_protection) %][% l.key %][% END %]</a><br />
<span>[% l.value.subject %]</span><br />
</li>
[% SET n = n + 1 %]
......
......@@ -1186,6 +1186,7 @@ while ($query = new_loop()) {
'color_15',
'reporting_spam_script_path',
'automatic_list_families',
'spam_protection',
) {
 
$param->{'conf'}{$p} = Conf::get_robot_conf($robot, $p);
......@@ -3232,98 +3233,15 @@ sub check_param_out {
}
}
 
## Email addresses protection
if (ref $list eq 'Sympa::List') {
if ($list->{'admin'}{'spam_protection'} eq 'at') {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = ' AT ';
$param->{'hidden_end'} = '';
} elsif ($list->{'admin'}{'spam_protection'} eq 'javascript') {
$param->{'protection_type'} = 'javascript';
$param->{'hidden_head'} = '
<script type="text/javascript">
<!--
document.write("';
$param->{'hidden_at'} = '" + "@" + "';
$param->{'hidden_end'} = '")
// -->
</script>';
} else {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = '@';
$param->{'hidden_end'} = '';
}
} else {
if (Conf::get_robot_conf($robot, 'spam_protection') eq 'at') {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = ' AT ';
$param->{'hidden_end'} = '';
} elsif (
Conf::get_robot_conf($robot, 'spam_protection') eq 'javascript') {
$param->{'protection_type'} = 'javascript';
$param->{'hidden_head'} = '
<script type="text/javascript">
<!--
document.write("';
$param->{'hidden_at'} = '" + "@" + "';
$param->{'hidden_end'} = '")
// -->
</script>';
} else {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = '@';
$param->{'hidden_end'} = '';
}
}
# Compat: 6.2.13 and earlier generated HTML archive etc. using these
# parameters for email addresses protection.
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = '@';
$param->{'hidden_end'} = '';
 
if (ref $list eq 'Sympa::List' and $list->{'name'}) {
wwslog('debug2', 'List-name %s', $list->{'name'});
 
## Email addresses protection
if ($in{'action'} eq 'arc') {
$param->{'protection_type'} = undef;
if ($list->{'admin'}{'web_archive_spam_protection'} eq 'at') {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = ' AT ';
$param->{'hidden_end'} = '';
} elsif ($list->{'admin'}{'web_archive_spam_protection'} eq
'javascript') {
$param->{'protection_type'} = 'javascript';
$param->{'hidden_head'} = '
<script type="text/javascript">
<!--
document.write("';
$param->{'hidden_at'} = '" + "@" + "';
$param->{'hidden_end'} = '")
// -->
</script>';
} else {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = '@';
$param->{'hidden_end'} = '';
}
} else {
if ($list->{'admin'}{'spam_protection'} eq 'at') {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = ' AT ';
$param->{'hidden_end'} = '';
} elsif ($list->{'admin'}{'spam_protection'} eq 'javascript') {
$param->{'hidden_head'} = '
<script type="text/javascript">
<!--
document.write("';
$param->{'hidden_at'} = '" + "@" + "';
$param->{'hidden_end'} = '")
// -->
</script>';
} else {
$param->{'hidden_head'} = '';
$param->{'hidden_at'} = '@';
$param->{'hidden_end'} = '';
}
}
# Owners and editors
foreach my $role (qw(owner editor)) {
foreach my $u ($list->get_admins($role)) {
......@@ -24230,6 +24148,7 @@ sub get_safe_robot_conf {
color_4 color_5 color_6 color_7 color_8 color_9 color_10 color_11
color_12 color_13 color_14 color_15
reporting_spam_script_path automatic_list_families
spam_protection
)
) {
$param->{'conf'}{$p} = $robot->$p;
......
......@@ -482,20 +482,20 @@ sub html_store {
);
my $tag = _get_tag($list);
if ( $list->{'admin'}{'web_archive_spam_protection'} ne 'none'
and $list->{'admin'}{'web_archive_spam_protection'} ne 'cookie') {
_set_hidden_mode($tag);
} else {
_unset_hidden_mode();
}
#XXXif ( $list->{'admin'}{'web_archive_spam_protection'} ne 'none'
#XXX and $list->{'admin'}{'web_archive_spam_protection'} ne 'cookie') {
#XXX _set_hidden_mode($tag);
#XXX} else {
#XXX _unset_hidden_mode();
#XXX}
# Call mhonarc on cleaned message source to make clean htlm view of
# message.
my @cmd = (
Conf::get_robot_conf($list->{'domain'}, 'mhonarc'),
'-add',
'-modifybodyaddresses',
'-addressmodifycode' => $ENV{'M2H_ADDRESSMODIFYCODE'},
#XXX'-modifybodyaddresses',
#XXX'-addressmodifycode' => $ENV{'M2H_ADDRESSMODIFYCODE'},
'-rcfile' => $mhonarc_ressources,
'-outdir' => $self->{arc_directory},
'-definevars' => sprintf(
......@@ -629,12 +629,12 @@ sub html_rebuild {
my $mhonarc_ressources =
Sympa::search_fullpath($list, 'mhonarc-ressources.tt2');
if ( $list->{'admin'}{'web_archive_spam_protection'} ne 'none'
and $list->{'admin'}{'web_archive_spam_protection'} ne 'cookie') {
_set_hidden_mode($tag);
} else {
_unset_hidden_mode();
}
#XXXif ( $list->{'admin'}{'web_archive_spam_protection'} ne 'none'
#XXX and $list->{'admin'}{'web_archive_spam_protection'} ne 'cookie') {
#XXX _set_hidden_mode($tag);
#XXX} else {
#XXX _unset_hidden_mode();
#XXX}
# Remove existing HTML files and .mhonarc.db.
my $dh;
......@@ -661,8 +661,8 @@ sub html_rebuild {
my @cmd = (
Conf::get_robot_conf($robot_id, 'mhonarc'),
'-modifybodyaddresses',
'-addressmodifycode' => $ENV{'M2H_ADDRESSMODIFYCODE'},
#XXX'-modifybodyaddresses',
#XXX'-addressmodifycode' => $ENV{'M2H_ADDRESSMODIFYCODE'},
'-rcfile' => $mhonarc_ressources,
'-outdir' => $arc_directory,
'-definevars' => sprintf(
......@@ -712,6 +712,7 @@ sub html_rebuild {
# Sets the value of $ENV{'M2H_ADDRESSMODIFYCODE'} and
# $ENV{'M2H_MODIFYBODYADDRESSES'}.
#* $tag a character string (containing the result of _get_tag($list))
# NO LONGER USED.
sub _set_hidden_mode {
# Tag is used as variable elements in tags to prevent message contents to
# be parsed
......@@ -725,6 +726,7 @@ sub _set_hidden_mode {
}
# Empties $ENV{'M2H_ADDRESSMODIFYCODE'}.
# NO LONGER USED.
sub _unset_hidden_mode {
# Be careful, the .mhonarc.db file keeps track of previous
# M2H_ADDRESSMODIFYCODE setup.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment