))
{
@litems = split(/\[::\]/,$line);
if ($icounter eq $litems[0])
{
$ritems = $line;
}
}
#if ($file_locking ne "No"){flock (ITEMS, LOCK_UN);}
close (ITEMS);
@litems2 = split(/\[::\]/,$ritems);
return (@litems2);
}
sub get_env
{
if ($ENV{'QUERY_STRING'} ne "") {
$temp = $ENV{'QUERY_STRING'};
}
else
{
read(STDIN, $temp, $ENV{'CONTENT_LENGTH'});
}
if ($temp =~ /\|/) { exit; }
@pairs=split(/&/,$temp);
foreach $item(@pairs) {
($key,$content)=split (/=/,$item,2);
$content=~tr/+/ /;
$content=~ s/%(..)/pack("c",hex($1))/ge;
$fields{$key}=$content;
}
$fields{'comment'}=~s/\cM//g;
$fields{'comment'}=~s/\n\n//g;
$fields{'comment'}=~s/\n/
/g;
$fields{'location'} =~ s/\///g; $fields{'location'} =~ s/%//g;
$fields{'ct'} =~ s/\///g; $fields{'ct'} =~ s/%//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: $!\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 get_vars
{
open (CIT, "$data_dir/config.cfg");
while (defined($line=))
{
$line =~ s/\n//g;
$configitems[$cntr] = $line;
$cntr++;
}
close (CIT);
# DIR_EXTENSION #0
# DEFAULT_INDEX #1
# INDEX_BUILD_SV #2
#
# LISTINGS_SORTEDBY #3
# DIR_ITEMS_PERPAGE #4
#
# SEARCH_ITEMS_PERPAGE #5
#
# NEXTPAGE_TEXT #6
# PREVPAGE_TEXT #7
# PAGES_TEXT #8
# NOT_RATED_TEXT #9
# REVIEW_TEXT #10
# RATE_IT_TEXT #11
# JSCRIPT_WINDOW_RATE_IT #12
# JSCRIPT_WINDOW_REVIEWS #13
# SEPERATOR_NEXTPREV #14
# CAT_DISPLAY_SEPERATOR #15
# NOMATCH_TEXT #16
# NO REVIEW TEXT #17
}
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=))
{
if ($line =~ m/#/g)
{
$r = pos($line);
$line = substr($line, 0, $r - 1);
}
$line =~ s/\n//g;
if ($line =~ /BUILD_DIR/){$line =~ s/BUILD_DIR//g; $line =~ s/ //g; $build_dir = $line;}
if ($line =~ /BUILD_URL/){$line =~ s/BUILD_URL//g; $line =~ s/ //g; $build_url = $line;}
if ($line =~ /SCRIPTS_URL/){$line =~ s/SCRIPTS_URL//g; $line =~ s/ //g; $scripts_url = $line;}
if ($line =~ /SCRIPTS_LOC/){$line =~ s/SCRIPTS_LOC//g; $line =~ s/ //g; $scripts_loc = $line;}
if ($line =~ /ADMIN_DIRECTORY/){$line =~ s/ADMIN_DIRECTORY//g; $line =~ s/ //g; $admin_directory = $line;}
if ($line =~ /SEND_MAIL/){$line =~ s/SEND_MAIL//g; $line =~ s/ //g; $sendmail_loc = $line;}
if ($line =~ /RGST/){$line =~ s/RGST//g; $line =~ s/ //g; $thspl = $line;}
if ($line =~ /USE_MYSQL/){$line =~ s/USE_MYSQL//g; $line =~ s/ //g; $use_mysql = $line;}
if ($line =~ /DB_NAME/){$line =~ s/DB_NAME//g; $line =~ s/ //g; $db_name = $line;}
if ($line =~ /DB_USERNAME/){$line =~ s/DB_USERNAME//g; $line =~ s/ //g; $db_username = $line;}
if ($line =~ /DB_PASSWORD/){$line =~ s/DB_PASSWORD//g; $line =~ s/ //g; $db_password = $line;}
if ($line =~ /MYSQL_HOSTNAME/){$line =~ s/MYSQL_HOSTNAME//g; $line =~ s/ //g; $mysql_hostname = $line;}
if ($line =~ /MYSQL_PORT/){$line =~ s/MYSQL_PORT//g; $line =~ s/ //g; $mysql_port = $line;}
if ($line =~ /FILE_LOCKING/){$line =~ s/FILE_LOCKING//g; $line =~ s/ //g; $file_locking = $line;}
if ($line =~ /CPUSERNAME/){$line =~ s/CPUSERNAME//g; $line =~ s/ //g; $c_username = $line;}
if ($line =~ /CPPASSWORD/){$line =~ s/CPPASSWORD//g; $line =~ s/ //g; $c_password = $line;}
}
close (STP);
}
#### END CONFIGURATION ########################################################
}