#!/usr/bin/perl
use CGI;
print "Content-type: text/html\n\n\n";
my $Home = "/usr/local/apache2/htdocs/fax";
my $Source = "$Home/source";
my $Archives = "$Home/archives";
my $AB_Archives = "$Home/ab";
my $Display = "$Home/display";
my $Home_Archives = "$Home/home";
`mkdir -p $Source`;
`mkdir -p $Archives`;
`mkdir -p $Display`;
`rsync -av /var/spool/fax/incoming/fax* $Source`;
`mkdir -p $AB_Archives`;
#------------------------------------
my @Files = <$Source/fax*>;
foreach my $File (@Files)
{
# print "$File\n";
my (@Temp) = split(/\//, $File);
my $File_Name = pop @Temp;
if (!(-e "$Archives/$File_Name\.pdf"))
{
print "
Processing new fax: $File\n";
my $Command = "tiff2ps $File > $Archives/$File_Name\.ps";
# print "$Command\n";
`$Command`;
my $Command = "/usr/bin/ps2pdf $Archives/$File_Name\.ps $Archives/$File_Name\.pdf";
# print "$Command\n";
`$Command`;
`cp $Archives/$File_Name\.pdf $Display/$File_Name\.pdf`;
}
}
#---------------------------------------
my $query = new CGI;
my $Action = $query->param('action');
my $File = $query->param('file');
$File =~ s/[^a-zA-Z0-9\_\.]//g;
if (!(-e "$Display/$File")) {}
elsif ($Action eq "archive")
{
print "
Archiving $File\n";
`rm -f $Display/$File`;
}
elsif ($Action eq "archive2")
{
print "
Archiving $File\n";
`cp $Display/$File $AB_Archives/`;
`rm -f $Display/$File`;
}
elsif ($Action eq "archive_home")
{
print "
Archiving $File\n";
`cp $Display/$File $Home_Archives/`;
`rm -f $Display/$File`;
}
print qq(
View Fax | Archive the Fax | Archive to AudioBoomerang |
---|