#!/opt/lampp/bin/perl

#########################################################
# Blah.pl                      |             Version: 2 #
#########################################################
# Software: e-blah!            |   Started on: 12/03/01 #
# Software created by: Justin  |   Current Status: Beta #
#########################################################
# Copyrighted 2001-2002 &copy; e-blah!                       #
# All Rights Reserved                                   #
# Licence Agreement included with software Package      #
#########################################################
# Download Software from:          http://www.eblah.com #
# Please do not provide download links without giving   #
# downloaders a link to eblah.com (for up-to-date info) #
# Thank you for your support for e-blah!                #
#########################################################

$version = '2.3B Beta (<b>PR5B</b>)';

# Check CPU Load (Remove in FINAL)
$benchmark = 0;
if($benchmark) {
	use Benchmark;
	$t0 = new Benchmark;
}

$scripttype = 'pl';  # Change to 'cgi' if your server does not allow '.pl'

use Fcntl ':flock';
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';

# To prevent ERROR
$languagep = "German";
$languages = "./Languages";
# / END

require "Settings.pl";
require("$languages/$languagep.lng");
$language = "$languages/$languagep";
&UFS;
require "$code/Routines.pl";
if($URL{'a'} ne 'bkupstart') { $SIG{__WARN__} = sub{ &error(@_,1); }; }
require "$code/Load.pl";

&CheckCookies;
&BoardCheck;
&ClickLog;
&AL;
&LMG;

if(($maintance || $noguest) || $lockout) { require "$code/BoardLock.pl"; &MainLO; }
&Ban;

&LoadBoard;
sub LoadBoard {
	if($showtheme && -e("$theme/$settings[26].v1") && ($URL{'v'} ne 'admin' || $URL{'a'} ne 'sets' || $URL{'s'} eq '')) { require("$theme/$settings[26].v1"); } # Prevents Theme ERROR

	if($URL{'v'} eq 'pm') { require("$code/PM.pl"); &PMIndex; }
	elsif($URL{'v'} eq 'whereis') { require("$code/WhereIs.pl"); &WhereIs; }
	elsif($URL{'v'} eq 'profile') { require("$code/Profile.pl"); &Profile; }
	elsif($URL{'v'} eq 'login') { require("$code/Login.pl"); &Login; }
	elsif($URL{'v'} eq 'mod') { require("$code/Moderate.pl"); &Moderate; }
	elsif($URL{'v'} eq 'register') { require("$code/Register.pl"); &Register; }
	elsif($URL{'v'} eq 'admin') { require("$code/Admin.pl"); &Admin; }
	elsif($URL{'v'} eq 'post') { require("$code/Post.pl"); &Post; }
	elsif($URL{'v'} eq 'ppoll') { require("$code/Poll.pl"); &PPoll; }
	elsif($URL{'v'} eq 'display') { require("$code/MessageDisplay.pl"); &MessageDisplay; }
	elsif($URL{'v'} eq 'mindex') { require("$code/MessageIndex.pl"); &MessageIndex; }
	elsif($URL{'v'} eq 'print') { require("$code/Print.pl"); &PrintDisplay; }
	elsif($URL{'v'} eq 'members') { require("$code/Members.pl"); &Members; }
	elsif($URL{'v'} eq 'report') { require("$code/Report.pl"); &Execute; }
	elsif($URL{'v'} eq 'cal') { require("$code/Calendar.pl"); &Cal; }
	elsif($URL{'v'} eq 'download') { require("$code/Attach.pl"); &Download; }
	elsif($URL{'v'} eq 'stats') { require("$code/Stats.pl"); &Stats; }
	elsif($URL{'v'} eq 'search') { require("$code/Search.pl"); &Search; }
	elsif($URL{'v'} eq 'invite') { require("$code/Invite.pl"); &Invite; }
	elsif($URL{'v'} eq 'notify') { require("$code/Notify.pl"); &Notify; }
	elsif($URL{'v'} eq 'recommend') { require("$code/Recommend.pl"); &Recommend; }
	elsif($URL{'v'} eq 'mark') { &Mark; }
	elsif($URL{'v'} eq 'shownews') { require("$code/News.pl"); &News; }
		else { require("$code/BoardIndex.pl"); &LoadIndex; }
}

sub UFS {
	my($query);
	@url = split(/\,/,$ENV{'QUERY_STRING'});
	foreach (@url) {
		($action,$actiondo) = split("=",$_);
		$URL{$action} = $actiondo;
	}
	$form = new CGI;
	foreach $var ($form->param) {
		if($form->param('ulfile')) {
			$del = $form->param('ulfile');
			$tulat = $form->tmpFileName($del);
		}
		$output = join(',',$form->param($var));
		$FORM{$var} = $output;
	}
}
1;
