Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r17104: LJRU-2138: Special URLs to count how man...

Committer: gariev
LJRU-2138: Special URLs to count how many people hit the link (and redirect them to their actual link)
U   trunk/cgi-bin/Apache/LiveJournal.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2010-08-10 07:00:55 UTC (rev 17103)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2010-08-10 08:50:43 UTC (rev 17104)
@@ -456,19 +456,11 @@
         return LJ::Request::DECLINED
     }
 
-    ##
-    if ($host eq $LJ::DOMAIN_WEB && $uri =~ m!^/redirect/!) {
-        my $url = $GET{'url'};
-        if ($url 
-            && $url =~ m! ^ https?:// [-\w.]*? ([-\w]+ \. [-\w]+) / !x 
-            && $LJ::ALLOWED_REDIRECT_TO_DOMAIN{$1}) 
-        {
-            return redir($url);
-        }
-        ## else - returns 404
+    ## TODO: handler/hooks like below must be modular/chainable/extendable
+    if (my $redirect_url = LJ::run_hook("should_redirect", $host, $uri, \%GET)) {
+        return redir($redirect_url);
     }
 
-
     my $journal_view = sub {
         my $opts = shift;
         $opts ||= {};

Tags: gariev, livejournal, pm
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