📄 forums.cgi
字号:
#!/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(-charset=>"gb2312"); print start_html(-title=>"ib2000 出错!");
print "不能够找到文件:$@\n如果您使用的是 Windows 类操作系统,请在每一个程序中更改 require 的设置,填入绝对路径!";
print end_html; exit;
}
$|++; # Unbuffer the output
#################--- Begin the program ---###################
$thisprog = "forums.cgi";
$query = new CGI;
$boardurltemp =$boardurl;
$boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/;
$cookiepath = $boardurltemp;
$cookiepath =~ s/$thisprog//sg;
$bypass = $query -> param('bypass');
$inforum = $query -> param('forum');
$intopic = $query -> param('topic');
$action = $query -> param('action');
$inshow = $query -> param('show');
$inthreadages = $query -> param('threadages');
$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 "客人")) {
$inmembername = "客人";
}
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)||($membercode eq "ad")) {
$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")||($membercode eq "ad")) { $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], -charset=>"gb2312");
&parseform;
if ($QUERY{'threadages'}){ &setcookie("threadages,$inthreadages"); }
elsif ($COOKIE{'threadages'}) { $inthreadages = $COOKIE{'threadages'}; }
elsif ($defaulttopicshow ne "") { $inthreadages = $defaulttopicshow; }
&forumjump;
if ($jumpto) {
print redirect(-location=>"$jumpto");
exit;
}
&getforum("$inforum");
# define the thread button/forumgraphic, forum moderator and thread age menu
$newthreadbutton = qq~<a href="$postprog?action=new&forum=$inforum"><img src="$imagesurl/images/newthread.gif" border="0" alt="发表一个新主题" width=106 height=23></a>~;
if ($forumgraphic) {
$forumgraphic = qq~<a href="$forumsprog?forum=$inforum"><img src="$imagesurl/images/$forumgraphic" border=0></a>~;
}
else { $forumgraphic = qq~<a href="$forumsprog?forum=$inforum"><img src="$imagesurl/images/$boardlogo" border=0></a>~; }
&moderator;
&title;
&threadage;
#### Days old options.
sub threadage {
$daysold = qq~
<form action="$forumsprog" method="get">
<input type=hidden name="forum" value="$inforum">
<select name="threadages">
<option value="all">查看所有的主题
<option value="1">查看一天内的主题
<option value="2">查看两天内的主题
<option value="7">查看一星期内的主题
<option value="15">查看半个月内的主题
<option value="30">查看一个月内的主题
<option value="60">查看两个月内的主题
<option value="180">查看半年内的主题
</select>
<input type="submit" value="go">
</form>
~;
}
# Print the header
$output .= qq~
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth align=center>
<tr>
<td width=30% rowspan=2 valign=top>$forumgraphic
</td>
<td align=left valign=top><font face="$font" color=$fontcolormisc>
<font face="$font" color=$fontcolormisc>
<img src="$imagesurl/images/closedfold.gif" border=0 width=15 height=11> <a href="$forumsummaryprog">$boardname</a>
<br>
<img src="$imagesurl/images/bar.gif" border=0 width=15 height=15><img src="$imagesurl/images/openfold.gif" border=0 width=15 height=11> $forumname
</td>
</tr>
$uservisitdata
</tr>
</table>
<br><br>
~;
# Check if it's a private forum, and is the member cleared?
if (("$privateforum" eq "yes") && ("$allowed" ne "yes")) { &accessneeded; }
&whosonline("$inmembername|<a href=\"$forumsprog?forum=$inforum\"><b>$forumname</b></a>|none|查看论坛上的主题|") if ($privateforum ne "yes");
&whosonline("$inmembername|<a href=\"$forumsprog?forum=$inforum\"><b>$forumname</b></a>(密)|none|查看保密论坛上的主题|") if ($privateforum eq "yes");
# Open up the forum threads list
$filetoopen = "$ikondir" . "forum$inforum/list.cgi";
$filetoopen = &stripMETA($filetoopen);
if (-e $filetoopen) {
open(FILE, "$filetoopen") or &error("打开论坛&对不起,这个论坛不存在!");
flock (FILE, 2) if ($OS_USED eq "Unix");
@topics = <FILE>;
close(FILE);
}
# Limit the total topics to a span
# $maxtopics = $maxthreads;
$numberofitems = @topics;
$numberofpages = $numberofitems / $maxthreads;
if ($numberofitems > $maxthreads) { #if
$showmore = "yes";
if ($inshow eq "" || $inshow < 0) { $inshow = 0; }
if ($inshow > 0) { $startarray = $inshow; }
else { $startarray = 0; }
$endarray = $inshow + $maxthreads - 1;
if ($endarray < ($numberofitems - 1)) { $more = "yes"; }
elsif (($endarray > ($maxthreads - 1)) && ($more ne "yes")) { $endarray = $numberofitems -1; }
} #
else {
$showmore = "no";
$startarray = 0;
$topicpages = qq~<font face="$font" color=$menufontcolor>本论坛只有一页</font>~;
# $toptopicpages = $topicpages;
$endarray = @topics - 1;
}
# if we have multiple pages, print them
if ($inthreadages) {
$threadagesstart = "&threadages=$inthreadages";
}
else {undef $threadagesstart;}
if ($showmore eq "yes") { #1
if ($maxthreads < $numberofitems) { #2
($integer,$decimal) = split(/\./,$numberofpages);
if ($decimal > 0) { $numberofpages = $integer + 1; }
$mypages=$numberofpages;
#分页
$intshow=$inshow/(12*$maxthreads);
($intshow,$mydecimal) = split(/\./,$intshow);
$intshow = $intshow + 1;
$preshow=($intshow-1)*12*$maxthreads-$maxthreads;
$nextshow=$intshow*12*$maxthreads;
$pages=qq~<a href="$thisprog?forum=$inforum&show=$preshow$threadagesstart"><font face="$font" color=$menufontcolor><b>←</b></font></a> ~ if ($intshow > 1);
if ($numberofpages > ($intshow*12)){
$numberofpages=($intshow*12);
$isnext=qq~<a href="$thisprog?forum=$inforum&show=$nextshow$threadagesstart"><font face="$font" color=$menufontcolor><b>→</b></font></a> ~;
}
$pagestart = ($intshow-1)*12*$maxthreads;
$counter = ($intshow-1)*12;
while ($numberofpages > $counter) { #3
$counter++;
if ($inshow ne $pagestart) { $pages .= qq~<a href="$thisprog?forum=$inforum&show=$pagestart$threadagesstart"><font face="$font" color=$menufontcolor><b>$counter</b></font></a> ~; }
else { $pages .= qq~<font face="$font" color=$fonthighlight><b>$counter</b></font> ~; }
$pagestart = $pagestart + $maxthreads;
} #e3
$pages .= $isnext;
#分页end
} #e2
$topicpages = qq~<font face="$font" color=$menufontcolor><b>本论坛共有 <font face="$font" color=$fonthighlight>$mypages</font> 页</b> [ $pages ]~;
} #1
# Limit the pages output at the top, so we don't distort the tables
# if ($numberofpages > 10) {
# $toptopicpages = qq~<font face="$font" color=$menufontcolor><b>本论坛含有多页</b> [ 查看下面 ]~;
# }
# else {
# $toptopicpages = $topicpages;
# }
$modoutput = "暂时空缺" if (!$modoutput);
# Print the forum top bar
&getonline("$forumname");
$output .= qq~
<table cellpadding=1 cellspacing=0 border=0 width=$tablewidth align=center>
<!-- Cgi-Bot Announcements from $dateposted -->
<tr>
<td align=left width=150 valign=middle>
<b>$newthreadbutton</b>
</td>
<td align=right valign=middle>
<p>$daysold</p>
</td>
<td align=center width=4 valign=middle>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth bgcolor=$tablebordercolor align=center>
<tr>
<td>
<table cellpadding=6 cellspacing=1 border=0 width=100%>
<tr>
<td bgcolor=$titlecolor width=92% align=left> <font face="$font" color=$titlefontcolor>$membertongji</td>
<td bgcolor=$titlecolor width=8% align=center><a href="javascript:this.location.reload()"><img src="$imagesurl/images/refresh.gif" border=0 alt="刷新本论坛" width=38 height=12></a></td>
</tr>
<tr>
<td colspan=2 bgcolor=$forumcolorone><font face="$font" color=$forumfontcolor>
$memberoutput</font></td>
</tr>
</table>
</td></tr>
</table><br>
~;
# Start printing the threads
$output .= qq~
<table cellpadding=0 cellspacing=0 border=0 width=$tablewidth align=center>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -