Committer: sbelyaev
LJSV-1557: Links in "Bio" section of profile pages and in custom sidebar text get "nofollow" attr. even for Paid usersU trunk/cgi-bin/cleanhtml.pl U trunk/htdocs/userinfo.bml
Modified: trunk/cgi-bin/cleanhtml.pl =================================================================== --- trunk/cgi-bin/cleanhtml.pl 2012-11-15 12:17:49 UTC (rev 23314) +++ trunk/cgi-bin/cleanhtml.pl 2012-11-16 08:18:09 UTC (rev 23315) @@ -174,7 +174,7 @@ my $ljspoiler_allowed = $enable_dynamic_elements; - my $poster = LJ::load_userid($opts->{posterid}); + my $poster = $opts->{poster} || LJ::load_userid($opts->{posterid}); my $put_nofollow = not ($poster and $poster->get_cap('paid') and not $poster->get_cap('trynbuy')); my $viewer_lang = $opts->{'viewer_lang'}; @@ -1207,7 +1207,7 @@ } if ($tag eq "a" and $hash->{href} and $put_nofollow) { - if ($hash->{href} =~ m!^https?://([^/]+?)(/.*)?$!) { + if ($hash->{href} =~ m!^(https?://)?([^/]+?)(/.*)?$!) { my $host = $1; unless ($host =~ /\Q$LJ::DOMAIN\E$/i) { $hash->{rel} = "nofollow"; @@ -2186,10 +2186,11 @@ } sub clean_userbio { - my $ref = shift; + my ($ref, %opts) = @_; + return undef unless ref $ref; - clean($ref, { + my %final_opts = ( 'wordlength' => 100, 'addbreaks' => 1, 'attrstrip' => [qw[style]], @@ -2200,7 +2201,10 @@ 'remove' => $userbio_remove, 'autoclose' => \@userbio_close, 'cleancss' => 1, - }); + %opts, + ); + + clean($ref, \%final_opts); } sub clean_s1_style Modified: trunk/htdocs/userinfo.bml =================================================================== --- trunk/htdocs/userinfo.bml 2012-11-15 12:17:49 UTC (rev 23314) +++ trunk/htdocs/userinfo.bml 2012-11-16 08:18:09 UTC (rev 23315) @@ -1025,7 +1025,7 @@ $u->{'bio'} = LJ::ehtml($u->{'bio'}); # XXXXX FIXME: TEMP FIX $u->{'bio'} =~ s!\n!<br />!g; } else { - LJ::CleanHTML::clean_userbio(\$u->{'bio'}); + LJ::CleanHTML::clean_userbio(\$u->{'bio'}, poster => $u); } LJ::EmbedModule->expand_entry($u, \$u->{'bio'});