#!/usr/bin/perl
# ^ change this line to your perl location path ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ #
###############################################################################
# UltraBoard 2000 by UltraScripts.com, Inc. #
# Copyright (c) 1999-2000 UltraScripts.com, Inc. All Rights Reserved. #
# Available from http://www.ub2k.com/ or http://www.ultrascripts.com/ #
###############################################################################
package UB;
BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File SDBM_File) }
BEGIN {
#############################################################################
$UB::PATH = "."; # < < < < < < < < < < < < < < < < < < < < < < < < < < < < #
# ^ change this line to the full path of this file ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ #
my $Program = $0;
$Program =~s/\\/\//g;
$Program =~s/^.*\/([^\/]+)$/$1/g;
unless (-e $UB::PATH."/".$Program) {
foreach my $path ( $0, $ENV{'SCRIPT_FILENAME'}, $ENV{'PATH_TRANSLATED'} ) {
$path =~s/\\/\//g;
$path =~s/^(.*)\/[^\/]+$/$1/g;
if (-e $path."/".$Program) {
$UB::PATH = $path and last;
}
}
}
unshift (@INC, "$UB::PATH");
unshift (@INC, "$UB::PATH/Private");
unshift (@INC, "$UB::PATH/Private/Variables");
unshift (@INC, "$UB::PATH/Private/Sources");
unshift (@INC, "$UB::PATH/Private/Sources/Libraries");
}
BEGIN { require "System.pm.pl"; import System qw($SYSTEM); }
BEGIN { require "General.pm.pl"; import General qw($GENERAL); }
require "Standard.pm.pl";
use CGI qw (:cgi);
use strict;
# for CGI.pm
$TempFile::TMPDIRECTORY = $SYSTEM->{'TEMP_PATH'} if $SYSTEM->{'CGI'};
###############################################################################
# Variables
$| = 1;
$UB::CGI = new CGI;
eval { require "Action.pm.pl"; } || &UB::CGIError("Can't run your request. $@", "");
###############################################################################
# Error function
sub Error {
my $platform = shift;
my %in= (ID => "", MESSAGE => "", @_);
my $message = $in{'MESSAGE'} || $in{'ID'};
$message =~ s/\n/
/g;
open (ERROR_LOG, ">>$SYSTEM->{'LOGS_PATH'}/error.log.txt");
print ERROR_LOG "$platform|^|400|^|$message|^||^|$ENV{'REMOTE_ADDR'}|^|".time."\n";
close (ERROR_LOG);
chmod (0777, "$SYSTEM->{'LOGS_PATH'}/error.log.txt");
&Standard::PrintHTMLHeader();
if ($platform eq "CP") {
require "Skins/$UB::GLOBAL{'SKIN'}/ControlPanel.pm.pl";
my $Interface = Skin::ControlPanel->new();
if ($in{'ID'}) {
print $Interface->Error(error => $Interface->{'LANGUAGE'}{ $in{'ID'} });
} else {
print $Interface->Error(error => $in{'MESSAGE'});
}
} else {
require "Skins/$UB::GLOBAL{'SKIN'}/UltraBoard.pm.pl";
my $Interface = Skin::UltraBoard->new();
if ($in{'ID'}) {
print $Interface->Error(error => $Interface->{'LANGUAGE'}{ $in{'ID'} });
} else {
print $Interface->Error(error => $in{'MESSAGE'});
}
}
exit;
}
###############################################################################
# CGIError function
# - function of display error message with form and environment information during internal error.
sub CGIError {
my ($message, $path) = @_;
my ($key, $space);
# checking the html header is it printed
unless ($UB::CONTENT_TYPE) {
print "Content-type: text/html\n\n";
$UB::CONTENT_TYPE = 1;
}
$message =~ s/\n/
/g;
open (ERROR_LOG, ">>$SYSTEM->{'LOGS_PATH'}/error.log.txt");
print ERROR_LOG "|^|500|^|$message|^|$path|^|$ENV{'REMOTE_ADDR'}|^|".time."\n";
close (ERROR_LOG);
chmod (0777, "$SYSTEM->{'LOGS_PATH'}/error.log.txt");
print "\n";
print "
\n";
print "CGI Script Error\n";
print "\n";
print "\n";
print "\n";
print "CGI Script Error\n";
print "\n";
# printing error message
#$message =~ s/\n/
\n/g;
$message and print $message;
print "";
if ($SYSTEM->{'ERROR_DETAIL'}) {
# printing general infomation
print "General Infomation
\n";
print "
\n";
if ($path) {
$path =~ s/\\/\//g;
print "\n";
print "| Error Path | \n";
print "$path | \n";
print "
\n";
}
if ($0) {
$0 =~ s/\\/\//g;
print "\n";
print "| Script Path | \n";
print "$0 | \n";
print "
\n";
}
if ($]) {
print "\n";
print "| Perl Version | \n";
print "$] | \n";
print "
\n";
}
if ($UB::VERSION) {
print "\n";
print "| UltraBoard Version | \n";
print "$UB::VERSION | \n";
print "
\n";
}
if ($CGI::VERSION) {
print "\n";
print "| CGI.pm Version | \n";
print "$CGI::VERSION | \n";
print "
\n";
}
print "
\n";
if (defined %UB::QUERY) {
# printing form variables
print "Form Variables
\n";
print "
\n";
foreach my $KEY (sort keys %UB::QUERY) {
print "\n";
print "| $KEY | \n";
print "".$UB::QUERY{$KEY}." | \n";
print "
\n";
}
print "
\n";
}
# printing environment variables
print "Environment Variables
\n";
print "
\n";
foreach $key (sort keys %ENV) {
print "\n";
print "| $key | \n";
print "".$ENV{$key}." | \n";
print "
\n";
}
print "
\n";
}
print "
\n";
print "
\n";
print "\n";
print "\n";
exit;
}