hachi (hachi) wrote in changelog,
hachi
hachi
changelog

[ljcom] r3856: Sup will be handling ad calls for users ...

Committer: hachi
Sup will be handling ad calls for users with the appropriate cap set.
U   trunk/cgi-bin/ljcom.pl
Modified: trunk/cgi-bin/ljcom.pl
===================================================================
--- trunk/cgi-bin/ljcom.pl	2006-11-02 01:08:31 UTC (rev 3855)
+++ trunk/cgi-bin/ljcom.pl	2006-11-02 02:10:11 UTC (rev 3856)
@@ -3694,6 +3694,33 @@
     return 0;
 });
 
+LJ::register_hook('construct_adcall', sub {
+    my %opts = @_; # This is the same opts that are passed to sub ads {} in weblib.pl
+
+    my $pagetype = delete $opts{'orient'};
+    my $username = delete $opts{'user'};
+    my $user     = LJ::load_user($username);
+
+    my $ip       = LJ::get_remote_ip();
+    my $remote   = LJ::get_remote();
+
+    return unless $user;
+    return unless $user->get_cap("sup_user");
+    return unless LJ::Knob->instance("adv-sup-all")->check($user->id);
+
+    my $ip_class = ip_class($ip);
+    return unless $ip_class;
+    return unless LJ::Knob->instance("adv-sup-$ip_class")->check($user->id);
+
+    my %params;
+
+    $params{adzone}    = $pagetype;
+    $params{journalid} = $user->id   if $user;
+    $params{remoteid}  = $remote->id if $remote;
+
+    return $LJ::SUP_BASE_ADCALL_URL . "?" . join( '&', map { "$_=$params{$_}" } keys %params );
+});
+
 LJ::register_hook('underage_redirect', sub {
     my $ar = shift;
     my $redir = $ar->{redirect};

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