Committer: gariev
LJSUP-9843: Need branding for livejournal.comU branches/r84.2/cgi-bin/LJ/Hooks/Homepage.pm
Modified: branches/r84.2/cgi-bin/LJ/Hooks/Homepage.pm =================================================================== --- branches/r84.2/cgi-bin/LJ/Hooks/Homepage.pm 2011-09-21 09:59:13 UTC (rev 11029) +++ branches/r84.2/cgi-bin/LJ/Hooks/Homepage.pm 2011-09-21 10:02:30 UTC (rev 11030) @@ -64,9 +64,44 @@ return 1; } +sub LJ::_is_branding_active { + ## Only homepage must be branded + my $uri = BML::get_uri(); + return unless $uri eq '/index.bml' or $uri eq '/'; + + ## Don't show to logged-in paid and basic accounts + my $remote = LJ::get_remote(); + return if $remote && ($remote->get_cap('paid') || !$remote->in_class('plus')); + + ## only Cyr users + return unless LJ::SUP->is_remote_sup; + + ## from 2011-09-22 00:00 MSK till 2011-09-29 23:59 MSK + my $time = time(); + ## TODO: uncomment the line below + ##return if ($time < 1316635200 || $time > 1317326340); ## uncomment this line before commit! + + return 1; +} + +LJ::register_hook("service_page_branding", sub { + my $opts = shift || {}; + + if (LJ::_is_branding_active()) { + my $rnd = int(rand(1_000_000)); + return '<a href="http://ad.adriver.ru/cgi-bin/click.cgi?sid=1&bt=21&ad=300226&pid=683257&bid=1351890&bn=1351890&rnd=197384386" target="_blank" class="brandinglove-link"> </a><img src="http://sup.adfox.ru/7386/getCode?p1=bdptx&p2=v&pe=b&pfc=jere&pfb=xyai&puid1=&puid2=&puid3=&puid4=&puid5=&pr=' . $rnd . '" width="1" height="1" border="0" class="brandinglove-pixel" /><img src="http://ad.adriver.ru/cgi-bin/rle.cgi?sid=1&bt=21&ad=300226&pid=683257&bid=1351890&bn=1351890&rnd=197384386" width="1" height="1" border="0" class="brandinglove-pixel" />' + } +}); + + LJ::register_hook("service_page_reskining", sub { my $params = shift || {}; - + + if (LJ::_is_branding_active()) { + LJ::need_res('stc/reskining/2011/september/love/homepage.css'); + return ''; + } + if (LJ::_is_super8_branding_active()) { LJ::need_res("stc/reskining/2011/june/super8/homepage.css"); return '';