;
close(FILE);
}
}
# Sort in posting order
sub postSort
{
(split(/$DBdelim/, $a))[4] <=> (split(/$DBdelim/, $b))[4];
}
# Sort in reverse-posting order
sub reverseSort
{
(split(/$DBdelim/, $b))[4] <=> (split(/$DBdelim/, $a))[4];
}
# Sort in alphabetical order on title
sub alphaSort
{
lc((split(/$DBdelim/, $a))[1]) cmp lc((split(/$DBdelim/, $b))[1]);
}
# Turn a database string into a pretty display
sub makePretty
{
my($url, $title, $description, $category, $time) =
split(/$DBdelim/, $_[0]);
$_ = $config{LinkTemplate};
s/\$url/$url/g;
s/\$title/$title/g;
s/\$description/$description/g;
s/\$date/gmtime($time)/eg;
"$_\n";
}
# Print out message
sub printMessage
{
my($title, @message) = @_;
print "$title\n", @message, "\n";
}
# Print out error message, log and exit
sub error
{
my($errorNum) = @_;
my($administrator);
&logPost("$sysError $errorNum") if $errorNum != $logFileError;
$administrator = "Please notify $config{Administrator}" if
$config{Administrator};
&printMessage($rejectTitle, "$sysError $errorNum", "$administrator");
exit 1;
}
# Log posting
# Uses: LogFile
sub logPost
{
return if !$config{LogFile};
open(LOGFILE, ">>$config{LogFile}") || &error($logFileError);
print LOGFILE scalar(localtime), ": ", @_, "\n";
close(LOGFILE);
}
# Print out usage information
sub usage
{
print <;
seek(DB, 0, 0);
};
&usage if !"$opt_i$opt_t$opt_c$opt_r$opt_e";
}
# Installation
sub install
{
my($mode, @script, $perl, $perlGuess);
$mode = (stat($0))[2];
# Check for script executability
print "Checking for executability...\n";
chmod($mode | 0111, $0) if ($mode & 0111) != 0111 &&
&isTrue(&confirm("Y", "Shall I make myself publically executable ",
"[Y/n]? "));
# Check for perl location and update script if necessary
print "Checking for PERL location...\n";
if (open(SCRIPT, "<$0"))
{
chomp($perl =