#!/usr/bin/perl
###############################################################################
#
# Module: news.pl
#
# (c)2001 fotograf4u, M.Bloch, 5.10.2001
#
# Main module for news script
#
###############################################################################

if( $ENV{'SERVER_SOFTWARE'} =~ /IIS/ ) {
	$nnIIS = 1;
	$0 =~ m~(.*)(\\|/)~;
	$nnpath = $1;
	$nnpath =~ s~\\~/~g;
	chdir($nnpath);
	push(@INC,$nnpath);
}

### Requirements and Errors ###
use CGI::Carp qw(fatalsToBrowser);

require "settings.pl";
require "$language";
require "$sourcedir/subs.pl";
require "$sourcedir/load.pl";
require "$sourcedir/sid.pl";

&LoadNews;
&LoadTemplate('list.htm');
&LoadProfile;
&sid_load;
&sid_write if ( "$sid" ne "" );

$SIG{__WARN__} = sub { &fatal_error( @_ ); };
eval {
	&nnmain;
};
if ($@) {
	&fatal_error("Untrapped Error:<BR> $@");
}

sub nnmain {

#	fopen(FILE, ">>$datadir/log.txt");
#	print FILE "===== We List It =====\n";
#	foreach (sort keys %INFO) {
#		print FILE "  \$INFO{\'$_\'} = $INFO{$_}\n";
#	}
#	foreach (sort keys %FORM) {
#		print FILE "  \$FORM{\'$_\'} = $FORM{$_}\n";
#	}
#	foreach (keys %UPLOAD) {
#		print FILE "  \$UPLOAD{\'$_\'} =\n";
#		my $p_data = $UPLOAD{$_};
#			foreach (sort keys %$p_data) {
#				print FILE "    File data: $_: $$p_data{$_}\n";
#				}
#
#	}
#	fclose(FILE);

	if ($action eq 'compose') { require "$sourcedir/admin.pl"; &Compose; }
	elsif ($action eq 'compose2') { require "$sourcedir/admin.pl"; &Compose2; }
	elsif ($action eq 'fileman') { require "$sourcedir/upload.pl"; &FileMan; }
	elsif ($action eq 'edit') { require "$sourcedir/admin.pl"; &Edit; }
	elsif ($action eq 'edit2') { require "$sourcedir/admin.pl"; &Edit2; }
	elsif ($action eq 'chpwd') { require "$sourcedir/admin.pl"; &ChPwd; }
	elsif ($action eq 'chpwd2') { require "$sourcedir/admin.pl"; &ChPwd2; }
	elsif ($action eq 'login' ) { require "$sourcedir/login.pl"; &Login; }
	elsif ($action eq 'login2' ) { require "$sourcedir/login.pl"; &Login2; }
	elsif ($action eq 'upload' ) { require "$sourcedir/upload.pl"; &Upload; }
	elsif ($action eq 'upload2' ) { require "$sourcedir/upload.pl"; &Upload2; }
	elsif ($action eq 'upload3' ) { require "$sourcedir/upload.pl"; &Upload3; }
	elsif ($action eq 'content' ) { require "$sourcedir/content.pl"; &Content; }
	elsif ($action eq 'content2' ) { require "$sourcedir/content.pl"; &Content2; }
	elsif ($action eq 'links' ) { require "$sourcedir/links.pl"; &Links; }
	elsif ($action eq 'links2' ) { require "$sourcedir/links.pl"; &Links2; }
	elsif ($action eq 'logout' ) { require "$sourcedir/login.pl"; &Logout; }
	elsif ($INFO{'num'}) { require "$sourcedir/list.pl"; &Show; }

	require "$sourcedir/list.pl";
	&List;

exit;

}

# news.pl

1;
