#!/usr/bin/perl
#
# $Id: downloads.pl,v 1.3 2006/01/23 21:39:30 ddoughty Exp $
#
# Source File: downloads.pl
# Get config
require 'sitecfg.pl';
require 'testlib.pl';
&app_initialize;
print "Content-Type: text/html\n\n";
if (&get_session($FORM{'tid'})) {
&LanguageSupportInit();
&log_entry($SESSION{'clid'}, $SESSION{'uid'}, "4", "Promo Downloads");
print "\n";
print "
\n";
if ($SESSION{'uac'} ne 'gadmin') {
print "\n";
print "You do not have privileges to make Database Structure Changes.\n";
print "\n";
} else {
@dlrecs = &get_data("downloads.dat");
$bFirst=1;
$downloads = "Materials Available for Download:\n";
if ($#dlrecs eq 0) {
$download = "- No downloads are currently available.\n";
} else {
foreach $dlrec (@dlrecs) {
$msg = "";
if ($bFirst) {
$bFirst = 0;
} else {
chop ($dlrec);
@flds = split(/&/, $dlrec);
$dlfile = join($pathsep, $pubroot, "downloads/$flds[2]");
open (TMPFILE, "<$dlfile") or $msg="nya";
if ($msg eq 'nya') {
$download = "
- $flds[1] (Coming Soon)\n";
} else {
binmode(TMPFILE);
$fsize = (stat(TMPFILE))[7];
close TMPFILE;
$download = "
- $flds[1] ($fsize bytes)\n";
}
$downloads = join('', $downloads , $download);
}
}
}
$downloads = join('', $downloads , "
\n");
$SYSTEM{'downloads'} = $downloads;
@dlrecs = ();
$downloads = "";
$download = "";
&show_template("download");
}
print "\n";
print "\n";
}