alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[ljcom] r11230: LJSUP-10461: Livejournal.sg redirecting

Committer: afedorov
LJSUP-10461: Livejournal.sg redirecting

U   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

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