Committer: afedorov
LJSUP-10461: Livejournal.sg redirectingU trunk/cgi-bin/LJ/Widget/HomepageEN.pm
Modified: trunk/cgi-bin/LJ/Widget/HomepageEN.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/HomepageEN.pm 2011-12-01 06:49:15 UTC (rev 11229) +++ trunk/cgi-bin/LJ/Widget/HomepageEN.pm 2011-12-01 13:31:56 UTC (rev 11230) @@ -39,13 +39,15 @@ ## Country blocks $result{country} = LJ::GeoLocation->get_country_info_by_ip; - if ($GET->{sgredirect} eq 'off') { - LJ::Request->set_cookie('non-sg-redirect' => '1', 'expires' => time + 86400); + if ($result{country} eq 'SG' || ( $remote && $remote->prop('country') eq 'SG')) { + if ($GET->{sgredirect} eq 'off') { + LJ::Request->set_cookie('non-sg-redirect' => '1', 'expires' => time + 15552000); + } + unless (LJ::Request->cookie('non-sg-redirect')) { + LJ::Request->redirect('http://www.livejournal.sg'); + LJ::Request->set_cookie('sg-redirect' => '1', 'expires' => time + 86400); + } } - if ($result{country} eq 'SG' && !(LJ::Request->cookie('non-sg-redirect'))) { - LJ::Request->redirect('http://www.livejournal.sg'); - LJ::Request->set_cookie('sg-redirect' => '1', 'expires' => time + 86400); - } $result{uk_block} = ( ## viewer is from UK