/g;
$fields{'comment'}=~s/\n/
/g;
}
sub get_template
{
my ($tfile) = @_;
$fsize1 = (-s "$data_dir/$tfile");
if ($fsize1 > 0)
{
open (DRST, "$data_dir/$tfile");
if ($file_locking ne "No"){flock (DRST, LOCK_SH) or die "Can't set lock for file: $data_dir/$tfile $!\n";}
read(DRST,$rval,$fsize1);
#if ($file_locking ne "No"){flock (DRST, LOCK_UN);}
close (DRST);
}
else
{
print "Could not find $data_dir/$tfile";
exit;
}
return ($rval);
}
sub getCookies
{
$temp2 = $ENV{'HTTP_COOKIE'};
@rawCookies = split (/; /,$temp2);
foreach $item2(@rawCookies)
{
($key, $val) = split (/=/,$item2,2);
$cookies{$key} = $val;
}
}
sub setCookie
{
# end a set-cookie header with the word secure and the cookie will only
# be sent through secure connections
local($name, $value, $expiration, $path, $domain, $secure) = @_;
print "Set-Cookie: ";
print ($name, "=", $value, "; expires=", $expiration,
"; path=", $path, "; ", $secure, "\n");
}
# sub setCookie
# {
#
# local($name, $value, $expiration) = @_;
# print "Set-Cookie: $name=$value; expires=$expiration\n";
#
#$expDate = "Saterday, 31-Dec-05 00:00:00 GMT";
#$path = "/cgi-bin/talkdungeon/d4all_2/";
#
#}
sub getCookies
{
$temp2 = $ENV{'HTTP_COOKIE'};
@rawCookies = split (/; /,$temp2);
foreach $item2(@rawCookies)
{
($key, $val) = split (/=/,$item2,2);
$cookies{$key} = $val;
}
}
sub decode_month
{
my ($themonth) = @_;
if ($themonth == 0) {$themonth = "Jan";}
if ($themonth == 1) {$themonth = "Feb";}
if ($themonth == 2) {$themonth = "Mar";}
if ($themonth == 3) {$themonth = "Apr";}
if ($themonth == 4) {$themonth = "Mei";}
if ($themonth == 5) {$themonth = "Jun";}
if ($themonth == 6) {$themonth = "Jul";}
if ($themonth == 7) {$themonth = "Aug";}
if ($themonth == 8) {$themonth = "Sep";}
if ($themonth == 9) {$themonth = "Oct";}
if ($themonth == 10) {$themonth = "Nov";}
if ($themonth == 11) {$themonth = "Dec";}
return ($themonth);
}
sub decode_weekday
{
my ($theweekday) = @_;
if ($theweekday == 0) {$theweekday = "Sunday";}
if ($theweekday == 1) {$theweekday = "Monday";}
if ($theweekday == 2) {$theweekday = "Tuesday";}
if ($theweekday == 3) {$theweekday = "Wednesday";}
if ($theweekday == 4) {$theweekday = "Thursday";}
if ($theweekday == 5) {$theweekday = "Friday";}
if ($theweekday == 6) {$theweekday = "Saterday";}
return ($theweekday);
}
sub vote_only_once
{
print "Content-type: text/html\n\n";
$fsize1 = (-s "$data_dir/rate_it_fail.html");
if ($fsize1 > 0)
{
open (DRST1, "$data_dir/rate_it_fail.html");
if ($file_locking ne "No"){flock (DRST1, LOCK_SH) or die "Can't set lock for file: $data_dir/rate_it_fail.html $!\n";}
read(DRST1,$rfail,$fsize1);
#if ($file_locking ne "No"){flock (DRST1, LOCK_UN);}
close (DRST1);
}
$rfail =~ s/!build_url!/$build_url/g;
$rfail =~ s/!!scripts_url!!/$scripts_url/g;
print $rfail;
exit;
}
sub get_setup
{
#### GET CONFIGURATION ########################################################
$csize = (-s "config.cgi");
open (RVF, "config.cgi");
read(RVF,$data_dir,$csize);
close (RVF);
$data_dir =~ s/\n//g;
$crit = chr(13); $crit =~ s/$crit//g;
$crit = chr(10); $crit =~ s/$crit//g;
$exists = (-e "$data_dir/setup.cfg");
if ($exists > 0)
{
open (STP, "$data_dir/setup.cfg");
while (defined($line=