#!/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"; use CGI qw(:standard); $CGI::POST_MAX=1024 * 150; $CGI::DISABLE_UPLOADS = 1; eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); ($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); require "ikon.lib"; require "data/progs.cgi"; require "data/boardinfo.cgi"; require "data/styles.cgi"; require "data/membertitles.cgi"; }; if ($@) { print header(); print start_html(-title=>"$ibtxt{'0025'}"); print "$ibtxt{'0026'} $@\n$ibtxt{'0027'}"; print end_html; exit; } $|++; #################--- Begin the program ---################### $thisprog = "topic.cgi"; $query = new CGI; $cookiepath = $query->url(-absolute=>1); $cookiepath =~ s/$thisprog//sg; $inforum = $query -> param('forum'); $inforum = &stripMETA("$inforum"); $intopic = $query -> param('topic'); $intopic = &stripMETA("$intopic"); $instart = $query -> param('start'); $instart = &stripMETA("$instart"); $jumpto = $query -> param('jumpto'); $jumpto = &stripMETA("$jumpto"); $inmembername = cookie("amembernamecookie"); $inpassword = cookie("apasswordcookie"); &forumjump; if ($jumpto) { print redirect(-location=>"$jumpto"); exit; } if (!$inmembername) { $inmembername = "$ibtxt{'0043'}"; } else { &getmember("$inmembername"); if ($allowedentry{$inforum} eq "yes") { $allowed = "yes"; } else { $allowed = "no"; } &getmemberstime("$inmembername"); &getlastvisit; $forumlastvisit = $lastvisitinfo{$inforum}; $currenttime = time; &setlastvisit("$inforum,$currenttime"); } print header(-cookie=>[$tempvisitcookie, $permvisitcookie]); &getforum($inforum); if ($forumgraphic) { $forumgraphic = qq~~; } else { $forumgraphic = qq~~; } $filetoopen = "$ikondir" . "forum$inforum/list.cgi"; $filetoopen = &stripMETA($filetoopen); if (-e $filetoopen) { open(FILE, "$filetoopen") or &error("$ibtxt{'3001'}&$ibtxt{'3002'}$inforum/list.cgi"); flock (FILE, 2); @allthreads = ; close(FILE); $totalthreadcount = @allthreads; $count = 0; open(FILE, ">$filetoopen"); flock(FILE, 2); foreach $line (@allthreads) { #start foreach @threads ($tempno, $trash) = split(/\|/, $line); chomp $line; push (@numbercounter, $tempno); if ($intopic eq $tempno) { ($topicid, $topictitle, $topicdescription, $threadstate, $threadposts ,$threadviews, $startedby, $startedpostdate, $lastposter, $lastpostdate) = split(/\|/,$line); $threadviews++; $keepcounter = $count; $linetokeep = "$topicid|$topictitle|$topicdescription|$threadstate|$threadposts|$threadviews|$startedby|$startedpostdate|$lastposter|$lastpostdate"; chomp $linetokeep; print FILE "$linetokeep\n"; } else { print FILE "$line\n"; } $count++; } close(FILE); my $file = "$ikondir" . "forum$inforum/$intopic.pl"; open(MSG, ">$file"); flock(MSG, 2); print MSG $linetokeep; close(MSG); } $totalthreadcount = @numbercounter; $totalthreadcount--; if ($intopic eq $numbercounter[0]) { undef $nextlink; } else { $nexttopic = $keepcounter - 1; $threadnext = $numbercounter[$nexttopic]; $nextlink = qq~ $ibtxt{'3003'} >>~; } if ($intopic eq $numbercounter[$totalthreadcount]) { undef $backlink; } else { $backtopic = $keepcounter + 1; $threadback = $numbercounter[$backtopic]; $backlink = qq~<< $ibtxt{'3004'} ~; } $nexttopiclinks = "$ibtxt{'3019'}
"; $nexttopiclinks .= "$backlink" if $backlink; $nexttopiclinks .= "$nextlink" if $nextlink; &postings; &whosonline("$inmembername|$ibtxt{'3020'} $topictitle $ibtxt{'2028'} $forumname|$ibtxt{'1602'}") if ($privateforum ne "yes"); &moderator; &title; $filetoopen = "$ikondir" . "forum$inforum/$intopic.thd"; $filetoopen = &stripMETA($filetoopen); if (-e $filetoopen) { open(FILE, "$filetoopen") or &error("$ibtxt{'3005'}&$ibtxt{'3006'}"); @threads = ; close(FILE); } ($trash, $topictitle) = split(/\|/,$threads[0]); $numberofitems = @threads; $numberofpages = $numberofitems / $maxthreads; if ($numberofitems > $maxthreads) { $showmore = "yes"; if ((!$instart) or ($instart < 0)) { $instart = 0; } if ($instart > 0) { $startarray = $instart; } else { $startarray = 0; } $endarray = $instart + $maxthreads - 1; if ($endarray < ($numberofitems - 1)) { $more = "yes"; } if (($endarray > ($maxthreads - 1)) and ($more ne "yes")) { $endarray = $numberofitems - 1; } } else { $showmore = "no"; $startarray = 0; $pages = qq~$ibtxt{'3007'}~; $endarray = $numberofitems - 1; } if ($showmore eq "yes") { if ($maxthreads < $numberofitems) { ($integer,$decimal) = split(/\./,$numberofpages); if ($decimal > 0) { $numberofpages = $integer + 1; } $pagestart = 0; $counter = 0; while ($numberofpages > $counter) { $counter++; if ($instart ne $pagestart) { $pages .= qq~$counter ~; } else { $pages .= qq~$counter ~; } $pagestart = $pagestart + $maxthreads; } } $pages = qq~$ibtxt{'3008'} [ $pages ]~; } if (("$privateforum" eq "yes" && "$allowed" ne "yes")) { &error("$ibtxt{'1606'}&$ibtxt{'1607'}"); } $printpageicon = qq~~; if ($privateforum ne "yes") { $sendtofriendicon = qq~~; } #------- HTML $output .= qq~ $uservisitdata
$forumgraphic
    $boardname
    $forumname
        $topictitle

$nexttopiclinks$pages
$ibtxt{'0604'} $modoutput
$printpageicon



~; #------- END HTML $editpostnumber = $startarray; $editpostnumber++; $postcountnumber = 0; foreach (@threads[$startarray .. $endarray]) { ($membername, $topictitle, $postipaddress, $showemoticons, $showsignature, $postdate, $post) = split(/\|/,$_); $postdate = $postdate + ($timedifferencevalue*3600) + ($timezone*3600); $postdate = &dateformat("$postdate"); &getmember("$membername"); if ($joineddate) { $joineddate = $joineddate + ($timedifferencevalue*3600) + ($timezone*3600); $joineddate = &joineddate("$joineddate"); } else { $joineddate = "$ibtxt{'3009'}"; } if (!$numberofposts) { $numberofposts = "$ibtxt{'3009'}"; } if (($post =~ /#Moderation Mode/i) and ($membercode eq 'mo' || $membercode eq 'ad')) { $post =~ s/<//g; $post =~ s/"/\"/g; } if ($htmlstate eq 'on') { $post =~ s/<//g; $post =~ s/"/\"/g; } if ($idmbcodestate eq 'on') { $post = &ikoncode("$post"); } if ($count eq 1) { $postbackcolor = "$postcolorone"; $postfontcolor = "$postfontcolorone"; $count++; } else { $postbackcolor = "$postcolortwo"; $postfontcolor = "$postfontcolortwo"; $count = 1; } if (($emoticons eq 'on') and ($showemoticons eq 'yes') and ($post =~ /:(.+?):/)) { $post = &doemoticons("$post"); } if (($emoticons eq 'on') && ($showemoticons eq 'yes')) { $post =~ s/\:\)//g; $post =~ s/\;\)//g; $post =~ s/\:\(//g; $post =~ s/\:o//g; } if (($signature) and ($showsignature eq 'yes')) { $signature =~ s//>/g; $signature =~ s/\&/\&/isg; $signature =~ s/\[b\]//isg; $signature =~ s/\[\/b\]/<\/b>/isg; $signature =~ s/\[i\]//isg; $signature =~ s/\[\/i\]/<\/i>/isg; $signature =~ s/\[url=\s*(.*?)\s*\]\s*(.*?)\s*\[\/url\]/$2<\/a>/isg; $signature =~ s/\[url\]\s*http:\/\/(.*?)\s*\[\/url\]/http:\/\/$1<\/a>/isg; $signature =~ s/\[url\]\s*(.*?)\s*\[\/url\]/$1<\/a>/isg; $signature =~ s/\[br\]/\/isg; $post = qq($post

-----
$signature); } if ($numberofposts > $mpostmark5) { $mtitle = "$mtitle5"; $membergraphic = "$mgraphic5"; } elsif ($numberofposts > $mpostmark4) { $mtitle = "$mtitle4"; $membergraphic = "$mgraphic4"; } elsif ($numberofposts > $mpostmark3) { $mtitle = "$mtitle3"; $membergraphic = "$mgraphic3"; } elsif ($numberofposts > $mpostmark2) { $mtitle = "$mtitle2"; $membergraphic = "$mgraphic2"; } else { $mtitle = "$mtitle1"; $membergraphic = "$mgraphic1"; } if ($membergraphic) { $membergraphic = ""; } if (($avatars eq "on") && ($useravatar) && ($useravatar ne "noavatar")) { $useravatar = qq(
); } else { undef $useravatar; } $memberfilename = $membername; $memberfilename =~ y/ /_/; if ($threadstate ne "closed") { $replygraphic = qq~
~; } else { undef $replygraphic; } $privatemessagegraphic = qq~~; $profilegraphic = qq~~; $editgraphic = qq~~; $partition = qq~~; if($showemail eq "yes") { $emailgraphic = qq~~; } else { undef $emailgraphic; } $homepage =~ s/http\:\/\///sg; if($homepage) { $homepagegraphic = qq~~; } else { undef $homepagegraphic; } if ($aolname) { $aolgraphic = qq~~; } else { undef $aolgraphic; } # if (($icqnumber) && ($icqnumber =~ /[0-9]/)) { $icqgraphic = qq~~; } # else { undef $icqgraphic; } if ($membercode eq "ad") { $posterfontcolor = "$adminnamecolor"; $membername = "$membername "; $membergraphic = ""; if ($membertitle eq "") { $membertitle = "$ibtxt{'1874'}"; } } elsif ($membercode eq "mo") { $posterfontcolor = "$teamnamecolor"; $membername = "$membername "; if ($membertitle eq "") { $membertitle = "$ibtxt{'0007'}"; } } elsif ($membercode eq "banned") { $posterfontcolor = "$posternamecolor"; $membergraphic = ""; $membertitle = "$ibtxt{'3010'}"; } else { $posterfontcolor = "$posternamecolor"; } if ($membertitle eq "member" || $membertitle eq "$ibtxt{'0136'}") { $membertitle = $mtitle; } $membertitle =~ s/<//g; $membertitle =~ s/"/"/g; $post =~ s/\($ibtxt{'1537'}(.+?)\)/\\($ibtxt{'1537'}$1\)\<\/font\>/isg; #------- HTML $output .= qq~
~; #------- END HTML $editpostnumber++; $postcountnumber++; } #------- HTML $output .= qq~
$newthreadbutton   $replybutton
$membername
$useravatar
$membergraphic
$membertitle
$editgraphic   $partition $profilegraphic $homepagegraphic $emailgraphic $privatemessagegraphic $aolgraphic $icqgraphic $partition   $replygraphic
$post



$ibtxt{'0212'} $numberofposts | $ibtxt{'3012'} $joineddate | $ibtxt{'0319'}: $postdate |
$newthreadbutton   $replybutton

$nexttopiclinks $pages $jumphtml

$ibtxt{'3014'} $ibtxt{'3015'} | $ibtxt{'3016'} | $ibtxt{'3017'} | $ibtxt{'3018'}

~; #------- END HTML &output( -Title => "$boardname - $topictitle", -ToPrint => $output, -Version => $versionnumber ); sub postings { $newthreadbutton = qq~~; if ($threadstate ne "closed") { $replybutton = qq~~; } else { $replybutton = qq~~; } } #------- END OF SCRIPT