#!/usr/bin/perl use lib '/home/dailyphoto/htdocs/content'; use lib '/home/lib'; #---------------------------------------------------------- # standard modules #---------------------------------------------------------- use CNET::lib; use strict; use CGI::Fast; use webshots::SuperLogEvent; use wsys::CalDate; use wsys::DPGlobals; use webshots::WebshotsUtility; while (my $cgi = new CGI::Fast) { my $photo = $cgi->param("photo"); my $day = $cgi->param("date"); my %REDIRECT_COOKIE = DPGlobals::ParseRedirectCookie($cgi->cookie("redirect")); my $username = WebshotsUtility::PeekUserName($cgi); #------------------------------------- # make sure photo is supplied #------------------------------------- if (!defined($photo)) { $photo=1; } #------------------------------------- # did caller pass in time? #------------------------------------- my $intime = $cgi->param('t'); if ($intime>0) { my $date = new CalDate; $date->SetEpoch($intime); $day = $date->GetYYYYMMDD(); } #------------------------------------- # build date if not supplied #------------------------------------- if ($day eq '') { my $date = new CalDate; $date->SetAsToday(); $day = $date->GetYYYYMMDD(); } #------------------------------------- # log it! #------------------------------------- SuperLogEvent::Log("dpphoto", 1, { PHOTO => $photo, USER => $REDIRECT_COOKIE{SWUSERID}} ); #------------------------------------- # no URL supplied, build it! #------------------------------------- my $url = "/content/dailyphoto/internal_data/dAtA$day/photo$photo-$day.wbz"; SuperLogEvent::Log("photo", 1, { PHOTO => $url, USER => $username } ); #------------------------------------- # redirect it! #------------------------------------- print "Status: 302 Found\n"; print "Uri: $url\n"; print "Location: $url\n"; print "Content-type: application/x-webshots\n\n"; }