#!/usr/bin/perl
#############################################################
# Ikonboard v2.1
# Copyright 2000 Ikondiscussion.com - All Rights Reserved
# Ikondiscussion is a trademark of Ikondiscussion.com
#
# Software Distributed by: Ikondiscussion.com
# Visit us online at http://www.ikondiscussion.com
# Email us on boards@ikondiscussion.com
#
# All files written by Matthew Mecham
#############################################################
use CGI::Carp "fatalsToBrowser"; # Output errors to browser
use CGI qw(:standard); # Saves loads of work
$CGI::POST_MAX=1024 * 150; # limit post data
$CGI::DISABLE_UPLOADS = 1; # Disable uploads
eval {
($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1");
require "ikon.lib"; # Require ikonboard ()
require "data/progs.cgi"; # Require prog names
require "data/boardinfo.cgi";# Require board info
require "data/styles.cgi"; # Require styles info
};
if ($@) {
print header(); print start_html(-title=>"$ibtxt{'0025'}");
print "$ibtxt{'0026'} $@\n$ibtxt{'0027'}";
print end_html; exit;
}
$|++; # Unbuffer the output
#################--- Begin the program ---###################
$thisprog = "forums.cgi";
$query = new CGI;
$cookiepath = $query->url(-absolute=>1);
$cookiepath =~ s/$thisprog//sg;
$bypass = $query -> param('bypass');
$inforum = $query -> param('forum');
$intopic = $query -> param('topic');
$action = $query -> param('action');
$inshow = $query -> param('show');
$jumpto = $query -> param('jumpto');
$inmembername = cookie("amembernamecookie");
$inpassword = cookie("apasswordcookie");
$bypass = &stripMETA("$bypass");
$inforum = &stripMETA("$inforum");
$intopic = &stripMETA("$intopic");
$action = &stripMETA("$action");
$inshow = &stripMETA("$inshow");
$jumpto = &stripMETA("$jumpto");
if ((!$inmembername) or ($inmembername eq "$ibtxt{'0043'}")) {
$inmembername = "$ibtxt{'0043'}";
}
else {
&getmemberstime("$inmembername");
&getlastvisit;
$forumlastvisit = $lastvisitinfo{$inforum};
$currenttime = time;
&setlastvisit("$inforum,$currenttime");
}
if ($action eq "accessrequired") {
$inmembername = $query -> param('membername');
$inpassword = $query -> param('password');
&getmember("$inmembername");
if ($userregistered ne "no" && $allowedentry{$inforum} eq "yes" && $inpassword eq $password) {
$allowcookiename = "forumsallowed" . "$inforum";
print "Set-Cookie: $allowcookiename=yes\;";
print "\n";
$allowed = "yes";
}
else {
$allowed = "no";
}
}
else {
$tempaccess = "forumsallowed". "$inforum";
$testentry = cookie("$tempaccess");
if ($testentry eq "yes") { $allowed = "yes"; }
else { $allowed = "no"; }
}
if ($action eq "resetposts") {
$currenttime = time;
$currenttime = ($currenttime+10);
$mv=1; &setlastvisit("$inforum,$currenttime");
print redirect(-location=>"$boardurl/$thisprog?forum=$inforum",
-cookie=>[$tempvisitcookie, $permvisitcookie]);
exit;
}
print header(-cookie=>[$tempvisitcookie, $permvisitcookie]);
&forumjump;
if ($jumpto) {
print redirect(-location=>"$jumpto");
exit;
}
&getforum("$inforum");
# define the thread button/forumgraphic, forum moderator and thread age menu
$newthreadbutton = qq~~;
if ($forumgraphic) {
$forumgraphic = qq~~;
}
else { $forumgraphic = qq~~; }
&moderator;
&title;
# Print the header
$output .= qq~
$forumgraphic
|
$boardname
$forumname
|
$uservisitdata
~;
# Check if it's a private forum, and is the member cleared?
if (("$privateforum" eq "yes") && ("$allowed" ne "yes")) { &accessneeded; }
if (($inmembername) && ($privateforum ne "yes")) { &whosonline("$inmembername|$ibtxt{'0617'} $forumname|$ibtxt{'1602'}"); }
# Open up the forum threads list
$filetoopen = "$ikondir" . "forum$inforum/list.cgi";
$filetoopen = &stripMETA($filetoopen);
if (-e $filetoopen) {
open(FILE, "$filetoopen") or &error("$ibtxt{'0618'}&$ibtxt{'0619'}");
@topics = ;
close(FILE);
}
# Limit the total topics to a span
$numberofitems = @topics;
$maxtopics = 15;
$numberofpages = $numberofitems / $maxtopics;
if ($numberofitems > $maxtopics) { #if
$showmore = "yes";
if ($inshow eq "" || $inshow < 0) { $inshow = 0; }
if ($inshow > 0) { $startarray = $inshow; }
else { $startarray = 0; }
$endarray = $inshow + $maxtopics - 1;
if ($endarray < ($numberofitems - 1)) { $more = "yes"; }
elsif (($endarray > ($maxtopics - 1)) && ($more ne "yes")) { $endarray = $numberofitems - 2; }
} #
else {
$showmore = "no";
$startarray = 0;
$topicpages = qq~$ibtxt{'0602'}~;
$toptopicpages = $topicpages;
$endarray = @topics - 1;
}
# if we have multiple pages, print them
if ($showmore eq "yes") { #1
if ($maxtopics < $numberofitems) { #2
($integer,$decimal) = split(/\./,$numberofpages);
if ($decimal > 0) { $numberofpages = $integer + 1; }
$pagestart = 0;
$counter = 0;
while ($numberofpages > $counter) { #3
$counter++;
if ($inshow ne $pagestart) { $pages .= qq~$counter ~; }
else { $pages .= qq~$counter ~; }
$pagestart = $pagestart + $maxtopics;
} #e3
} #e2
$topicpages = qq~$ibtxt{'0603'} [ $pages ]~;
} #1
# Limit the pages output at the top, so we don't distort the tables
if ($numberofpages > 10) {
$toptopicpages = qq~$ibtxt{'0603'} [ $ibtxt{'0620'} ]~;
}
else {
$toptopicpages = $topicpages;
}
# Print the forum top bar
$output .= qq~
~;
# Start printing the threads
$output .= qq~
$newthreadbutton |
erstellt von |
Antworten |
Abrufe |
Letzter Beitrag |
~;
# Grab the threads to show
foreach $topic (@topics[$startarray ... $endarray]) { # start topic foreach
chomp $topic;
($topicid, $topictitle, $topicdescription, $threadstate, $threadposts, $threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate) = split(/\|/,$topic);
# Span time, yet again. Who needs sub-routes?
$numberofitems = $threadposts + 1;
$numberofpages = $numberofitems / $maxthreads;
if ($numberofitems > $maxthreads) { #if
if ($maxthreads < $numberofitems) { #2
($integer,$decimal) = split(/\./,$numberofpages);
if ($decimal > 0) { $numberofpages = $integer + 1; }
$pagestart = 0;
$counter = 0;
while ($numberofpages > $counter) { #3
$counter++;
$threadpages .= qq~ $counter ~;
$pagestart = $pagestart + $maxthreads;
} #e3
} #e2
$pagestoshow = qq~ [ $ibtxt{'0605'} $threadpages ]~;
} #1
# Forum Post markers
if (!$forumlastvisit) { $forumlastvisit = "0"; }
$topicicon = "";
if (($threadposts => $hottopicmark) && ($forumlastvisit < $lastpostdate) && ($inmembername ne "$ibtxt{'0043'}")) {
$topicicon = "";
}
if (($threadposts => $hottopicmark) && ($forumlastvisit > $lastpostdate) && ($inmembername ne "$ibtxt{'0043'}")) {
$topicicon = "";
}
if (($threadposts < $hottopicmark) && ($forumlastvisit < $lastpostdate) && ($inmembername ne "$ibtxt{'0043'}")) {
$topicicon = "";
}
if (($threadposts < $hottopicmark) && ($forumlastvisit > $lastpostdate) && ($inmembername ne "$ibtxt{'0043'}")) {
$topicicon = "";
}
unless ($threadstate ne "closed") {
$topicicon = "";
}
if ($lastpostdate ne "") {
$lastpostdate = $lastpostdate + ($timedifferencevalue*3600) + ($timezone*3600);
$longdate = &longdate("$lastpostdate");
$shorttime = &shorttime("$lastpostdate");
$lastpostdate = qq~$longdate - $shorttime~;
}
else {
$lastpostdate = qq~$ibtxt{'3009'}~;
$lastpoststamp = "";
}
$startedpostdate = $startedpostdate + ($timedifferencevalue*3600) + ($timezone*3600);
$startedlongdate = &shortdate("$startedpostdate");
$startedshorttime = &shorttime("$startedpostdate");
$startedpostdate = qq~$startedlongdate~;
$topictitle = qq~$topictitle~;
$startedbyfilename = $startedby;
$startedbyfilename =~ s/ /\_/isg;
$lastposterfilename = $lastposter;
$lastposterfilename =~ s/ /\_/isg;
$lastposter = qq~$lastposter~;
if ($topicdescription) { $topicdescription = qq~ »$topicdescription~; }
$output .=qq~
$topicicon |
$topictitle $pagestoshow $topicdescription |
$startedby |
$threadposts |
$threadviews |
$lastpostdate von $lastposter |
~;
$pagestoshow = undef;
$threadpages = undef;
} # end topic foreach
$output .= qq~
$newthreadbutton |
|
|
$ibtxt{'0606'} |
|
$ibtxt{'0607'} |
~;
if ($inmembername ne "$ibtxt{'0043'}") {
$output .= qq~
|
$ibtxt{'0608'} |
|
$ibtxt{'0609'} $hottopicmark $ibtxt{'0011'} |
~;
}
$output .= qq~
~;
$output =~ s/value=\"$inthreadages\"/value=\"$inthreadages\" selected/;
&output(
-Title => "$boardname > $category > $forumname",
-ToPrint => $output,
-Version => $versionnumber
);
#### Access needed form
sub accessneeded {
$output .= qq~
~;
&output(
-Title => "$boardname",
-ToPrint => $output,
-Version => $versionnumber
);
}