Committer: garievLJSUP-5193: Add ability to transfer flashvars into the flash embeded into the posts in drugoi.livejournal.com
U trunk/cgi-bin/LJ/Hooks/SUP.pm
Modified: trunk/cgi-bin/LJ/Hooks/SUP.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/SUP.pm 2009-11-24 10:30:26 UTC (rev 7919)
+++ trunk/cgi-bin/LJ/Hooks/SUP.pm 2009-11-24 11:12:42 UTC (rev 7920)
@@ -760,16 +760,39 @@
return LJ::HomepageItems->get_vgift_items();
});
+## 484155 == drugoi
+## 11130707 == sekvo, test account on production servers
+## 2 == test account on dev server
+my %drugoi_campaign_journals = ($LJ::IS_DEV_SERVER) ?
+ ( 2 => 1 ) :
+ map { $_ => 1 } (484155, 11130707);
+
LJ::register_hook('modify_embed_iframe_params', sub {
my ($params, $journalu, $remote)= @_;
## This is a temporary hack for ad campaing in drugoi's blog.
## Pass params "pID" - the photo ID, from URL and "uNAME" - visitor username
## to URL of embedded iframe
- return unless $journalu && $journalu->{user} eq 'drugoi';
-
- $params->{pID} = $BMLCodeBlock::GET{'photoId'};
+ return unless $journalu && $drugoi_campaign_journals{ $journalu->{userid} };
+
+ my %getargs = eval { Apache->request->args };
+ $params->{pID} = $getargs{'photoId'};
$params->{uNAME} = $remote->{user} if $remote;
});
+LJ::register_hook('modify_embed_content', sub {
+ my ($content_ref, $get)= @_;
+
+ ## This is a temporary hack for ad campaing in drugoi's blog
+ return unless $get->{journalid} && $drugoi_campaign_journals{ $get->{journalid} };
+
+ my $id = LJ::ehtml($get->{pID});
+ my $name = LJ::ehtml($get->{uNAME});
+ $$content_ref =~ s/lg_company_full/USERNAME=$name&ID=$id/g;
+ $$content_ref =~ s/lg_company_name/$name/g;
+ $$content_ref =~ s/lg_company_id/$id/g;
+});
+
+
+
1;