#!/usr/bin/perl --
# $Id: album_recent.pm,v 1.2 2004/09/13 15:28:10 bobbitt Exp $
######################## START OF POD ########################
=head1 NAME
recent.pm - recent upload, random photo and popular functions for album.pl.
=head1 INFORMATION
Author: J.J.Frister, taken from album.pl Mike Bobbitt (Mike@Bobbitt.ca), Cipher Logic Canada Inc.
For updates, instructions and examples see http://perl.bobbitt.ca/forums on the web.
=head1 LICENSE
This program is © 1999-2004 Cipher Logic Canada Inc. & © 2004 fristersoft. All Rights Reserved.
As long as you leave this POD section and my contact info above in tact, feel free to use this as you see fit. You can pretty much do anything with this script except resell it. :)
If you come up with any good modifications to it, please let me know. I'd love to fold your mod into the public version (with credit, of course).
Good luck!
=head1 SUBROUTINES
=cut
######################## END OF POD ########################
######################## START OF SUBROUTINES ########################
##########################################################################
=head3 recentUploads()
$recent_html=recentUploads();
$recent_html - Contains the HTML for the recent uploads table.
Returns HTML for the last $::recent_uploads number of uploads, as read from $::upload_logfile.
=cut
sub recentUploads
{
my $count=$::recent_uploads;
my $data;
my $filetemp;
my $photoinf;
my $temp;
my $allphotos;
my @photoarray;
my @timearray;
my @userarray;
my $recent_html;
my $allusers;
my $alltimes;
my $tempalbum;
my $tempmiddle;
my $tempgoback;
my $realcount;
my $showall=$form->param('showall');
# Do a sanity check first...
if (!$::upload_logfile || !$::recent_uploads || !-r $::upload_logfile)
{
return($::S{194});
}
$tempalbum=$::album;
$tempmiddle=$::middle;
$tempgoback=$::goback;
$::album=$::middle=$::goback="";
$::isimage=1;
if ($::ssi)
{
$count=$::ssi;
}
open(UPLOADLOG,"$::upload_logfile") || error(__LINE__,"not_readable","$::upload_logfile: $!",$::recent_module);
while ($data=
\n$::S{291}";
}
$::album=$tempalbum;
$::middle=$tempmiddle;
$::goback=$tempgoback;
return($recent_html);
}
##########################################################################
=head3 randomizer()
$photo=randomizer();
$photo - Returned path (from album root) to a random photo.
Returns the path to a random image in the album.
=cut
sub randomizer
{
my $randpic;
my $rnd;
my $doing_upload_temp;
debug("Entering subroutine: randomizer()",4,__LINE__,$::recent_module);
$doing_upload_temp=$::doing_upload;
$::doing_upload=2;
recursiveScan($::album_dir);
# Count total number of objects
$rnd=($#::total_photo_list)+1;
debug("Objects ($rnd total): [@::total_photo_list]",2,__LINE__,$::recent_module);
$rnd=int rand($rnd);
$randpic=@::total_photo_list[$rnd];
debug("Picked dir #$rnd [$randpic]",2,__LINE__,$::recent_module);
$::doing_upload=$doing_upload_temp;
debug("Leaving subroutine: randomizer()",4,__LINE__,$::recent_module);
return($randpic);
}
##########################################################################
=head3 searchForm()
$html=searchForm();
$html - The search results, formatted in HTML.
Returns the search web form.
=cut
sub searchForm
{
my $html;
$html=<