#!/usr/bin/perl
#
#-------------------------------------------------------------------------------
# DISCUS COPYRIGHT NOTICE
#
# Discus is copyright (c) 2002 by DiscusWare, LLC, all rights reserved.
# The use of Discus is governed by the Discus License Agreement which is
# available from the Discus WWW site at:
#    http://www.discusware.com/discus/license
#
# Pursuant to the Discus License Agreement, this copyright notice may not be
# removed or altered in any way.
#-------------------------------------------------------------------------------

use strict;
use vars qw($GLOBAL_OPTIONS $PARAMS $DCONF);

$DCONF->{script_dir} = "/home/httpd/saveourbay.org/html/forum/discus";
my $e = get_cgi_extension($0);

if (-e "$DCONF->{script_dir}/config.$e") {
	require "$DCONF->{script_dir}/config.$e";
} elsif (-e "./config.$e") {
	require "./config.$e";
} else {
	print "Content-type: text/html\n\n";
	print "Script Execution Error: <b>config.*** location error [1]</b>.\n";
	exit(0);
}
discus("discus");

sub get_cgi_extension {
	my ($zero) = @_;
	if ($zero =~ m|\.(\w+)$|) {
		return $1;
	}
	foreach my $try ('cgi', 'pl') {
		return $try if -e "./config.$try";
	}
	opendir(DIR, ".");
	while (my $i = readdir(DIR)) {
		return $1 if $i =~ m|^config\.(\w+)$|;
	}
	closedir(DIR);
	print "Content-type: text/html\n\n";
	print "Script Execution Error: <b>config.*** location error [2]</b>.\n";
	exit(0);
}

1;