alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[ljcom] r12255: LJSUP-12875: Add banner for livejournal....

Committer: afedorov
LJSUP-12875: Add banner for livejournal.com only for Russia

U   trunk/cgi-bin/LJ/Hooks/Homepage.pm
Modified: trunk/cgi-bin/LJ/Hooks/Homepage.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/Homepage.pm	2012-07-10 08:51:44 UTC (rev 12254)
+++ trunk/cgi-bin/LJ/Hooks/Homepage.pm	2012-07-10 10:08:23 UTC (rev 12255)
@@ -45,6 +45,24 @@
     return 1;
 }
 
+sub LJ::_is_sopa_branding_active {
+    ## LJSUP-12875: from now till 10.07.2012 23:59 Moscow time 
+    my $time = time();
+    return if $time > 1341950399; 
+
+    ## Only homepage must be branded
+    return unless LJ::Request->hostname eq "www.$LJ::DOMAIN";
+ 
+    my $uri = LJ::Request->uri;
+    return unless $uri eq '/index.bml' or $uri eq '/';
+ 
+    ## Show only for Russia
+    my $country = LJ::GeoLocation->get_country_info_by_ip;
+    return unless $country eq 'RU';
+
+    return 1;    
+}
+
 sub LJ::_is_branding_active { 
     ## Only homepage must be branded 
     return unless LJ::Request->hostname eq "www.$LJ::DOMAIN"; 
@@ -75,6 +93,14 @@
     my $opts = shift || {};
     my $time = time(); 
 
+    # SOPA
+    if (LJ::_is_sopa_branding_active()) {
+        LJ::need_res("stc/reskining/2012/july/sopa/sopa.css");
+        my $text = LJ::Lang::ml('homepage.branding.sopa.text');
+        LJ::CleanHTML::clean(\$text, { allow => [ 'a' ] });
+        return '<div class="l-sopa"><div class="b-sopa"><div class="b-sopa-in">'.$text.'</div></div></div>';
+    }
+
     # google
     # 5 july 00:00 - 8 july 23:59
     if (LJ::_is_branding_active() && ($time > 1341432000 && $time < 1341777540)) { 

Tags: afedorov, ljcom, pm, red_alf
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