Brad Whitaker (whitaker) wrote in changelog,
Brad Whitaker
whitaker
changelog

[livejournal] r12394: -- don't provide SHA1 of email addresses...

Committer: whitaker
-- don't provide SHA1 of email addresses unless they
are public


U   trunk/cgi-bin/LJ/M/ProfilePage.pm
U   trunk/cgi-bin/LJ/S2.pm
U   trunk/cgi-bin/LJ/User.pm
U   trunk/cgi-bin/ljfeed.pl
U   trunk/cgi-bin/ljviews.pl
Modified: trunk/cgi-bin/LJ/M/ProfilePage.pm
===================================================================
--- trunk/cgi-bin/LJ/M/ProfilePage.pm	2007-08-31 22:29:27 UTC (rev 12393)
+++ trunk/cgi-bin/LJ/M/ProfilePage.pm	2007-08-31 23:33:01 UTC (rev 12394)
@@ -61,12 +61,13 @@
     my $self = shift;
     my $u = $self->{u};
     my $jbase = $u->journal_base;
+    my $remote = LJ::get_remote();
     my $ret;
 
     $ret .= "<link rel='alternate' type='application/rss+xml' title='RSS' href='$jbase/data/rss' />\n";
     $ret .= "<link rel='alternate' type='application/atom+xml' title='Atom' href='$jbase/data/atom' />\n";
     $ret .= "<link rel='alternate' type='application/rdf+xml' title='FOAF' href='$jbase/data/foaf' />\n";
-    if ($u->email_raw) {
+    if ($u->email_visible($remote)) {
         my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
         $ret .= "<meta name=\"foaf:maker\" content=\"foaf:mbox_sha1sum '$digest'\" />\n";
     }

Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2007-08-31 22:29:27 UTC (rev 12393)
+++ trunk/cgi-bin/LJ/S2.pm	2007-08-31 23:33:01 UTC (rev 12394)
@@ -1904,8 +1904,8 @@
         $p->{'head_content'} .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $opts->{'saycharset'} . "\" />\n";
     }
 
+    my $remote = LJ::get_remote();
     if (LJ::are_hooks('s2_head_content_extra')) {
-        my $remote = LJ::get_remote();
         $p->{head_content} .= LJ::run_hook('s2_head_content_extra', $remote, $opts->{r});
     }
 
@@ -1942,9 +1942,12 @@
 
     # FOAF autodiscovery
     my $foafurl = $u->{external_foaf_url} ? LJ::eurl($u->{external_foaf_url}) : "$p->{base_url}/data/foaf";
-    my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
     $p->{head_content} .= qq{<link rel="meta" type="application/rdf+xml" title="FOAF" href="$foafurl" />\n};
-    $p->{head_content} .= qq{<meta name="foaf:maker" content="foaf:mbox_sha1sum '$digest'" />\n};
+    
+    if ($u->email_visible($remote)) {
+        my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
+        $p->{head_content} .= qq{<meta name="foaf:maker" content="foaf:mbox_sha1sum '$digest'" />\n};
+    }
 
     # Identity (type I) accounts only have friends views
     $p->{'views_order'} = [ 'friends', 'userinfo' ] if $u->{'journaltype'} eq 'I';

Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2007-08-31 22:29:27 UTC (rev 12393)
+++ trunk/cgi-bin/LJ/User.pm	2007-08-31 23:33:01 UTC (rev 12394)
@@ -7062,10 +7062,13 @@
 
         # FOAF autodiscovery
         my $foafurl = $u->{external_foaf_url} ? LJ::eurl($u->{external_foaf_url}) : "$journalbase/data/foaf";
-        my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
         $head .= qq{<link rel="meta" type="application/rdf+xml" title="FOAF" href="$foafurl" />\n};
-        $head .= qq{<meta name="foaf:maker" content="foaf:mbox_sha1sum '$digest'" />\n};
 
+        if ($u->email_visible($remote)) {
+            my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
+            $head .= qq{<meta name="foaf:maker" content="foaf:mbox_sha1sum '$digest'" />\n};
+        }
+
         return qq{
             <html>
             <head>

Modified: trunk/cgi-bin/ljfeed.pl
===================================================================
--- trunk/cgi-bin/ljfeed.pl	2007-08-31 22:29:27 UTC (rev 12393)
+++ trunk/cgi-bin/ljfeed.pl	2007-08-31 23:33:01 UTC (rev 12394)
@@ -595,7 +595,12 @@
     $ret .= "   xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
 
     # precompute some values
-    my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
+    my $digest = "";
+    if ($u->is_validated) {
+        my $remote = LJ::get_remote();
+        my $email_visible = $u->email_visible($remote);
+        $digest = Digest::SHA1::sha1_hex("mailto:$email_visible") if $email_visible;
+    }
 
     # channel attributes
     $ret .= ($comm ? "  <foaf:Group>\n" : "  <foaf:Person>\n");
@@ -616,7 +621,7 @@
     if ($u->{bdate} && $u->{bdate} ne "0000-00-00" && !$comm && $u->can_show_full_bday) {
         $ret .= "    <foaf:dateOfBirth>".$u->bday_string."</foaf:dateOfBirth>\n";
     }
-    $ret .= "    <foaf:mbox_sha1sum>$digest</foaf:mbox_sha1sum>\n" if $u->is_validated;
+    $ret .= "    <foaf:mbox_sha1sum>$digest</foaf:mbox_sha1sum>\n" if $digest;
 
     # userpic
     if (my $picid = $u->{'defaultpicid'}) {

Modified: trunk/cgi-bin/ljviews.pl
===================================================================
--- trunk/cgi-bin/ljviews.pl	2007-08-31 22:29:27 UTC (rev 12393)
+++ trunk/cgi-bin/ljviews.pl	2007-08-31 23:33:01 UTC (rev 12394)
@@ -1156,10 +1156,13 @@
 
     # FOAF autodiscovery
     my $foafurl = $u->{external_foaf_url} ? LJ::eurl($u->{external_foaf_url}) : "$journalbase/data/foaf";
-    my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
     $lastn_page{head} .= qq{<link rel="meta" type="application/rdf+xml" title="FOAF" href="$foafurl" />\n};
-    $lastn_page{head} .= qq{<meta name="foaf:maker" content="foaf:mbox_sha1sum '$digest'" />\n};
 
+    if ($u->email_visible($remote)) {
+        my $digest = Digest::SHA1::sha1_hex('mailto:' . $u->email_raw);
+        $lastn_page{head} .= qq{<meta name="foaf:maker" content="foaf:mbox_sha1sum '$digest'" />\n};
+    }
+
     $lastn_page{'head'} .=
         $vars->{'GLOBAL_HEAD'} . "\n" . $vars->{'LASTN_HEAD'};
 

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments