⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 view.cgi

📁 一个linux论坛
💻 CGI
📖 第 1 页 / 共 2 页
字号:
#!/usr/bin/perl
#######################################################
#  LB5000MX 源程序版权所有:CGI编程者之家 (CGIer.com)
#
#  程序编写:山鹰糊 (Shining Hu)、花无缺 (Ifairy Han)
#
#  程序修改:BigJim (94Cool.Net)
#######################################################

BEGIN
{
	$LBPATH = '.';
	my $pgm = $0;
	$pgm =~ s/\\/\//g;
	$pgm =~ s/^.*\/([^\/]+)$/$1/g;
	unless (-e $LBPATH.'/'.$pgm)
	{
		foreach ($0, $ENV{'SCRIPT_FILENAME'}, $ENV{'PATH_TRANSLATED'})
		{
			s!\\!/!g;
			s/^(.*)\/[^\/]+$/$1/g;
			if (-e $_ . '/' .$pgm)
			{
				$LBPATH = $_;
				last;
			}
		}
	}
	unshift(@INC, "$LBPATH");
}

use LBCGI;
$LBCGI::POST_MAX = 2000;
$LBCGI::DISABLE_UPLOADS = 1;
$LBCGI::HEADERS_ONCE = 1;
require "code.cgi";
require "data/boardinfo.cgi";
require "data/styles.cgi";
require "lb.lib.pl";
require "visitforum.lib.pl";
$|++;

$thisprog = "view.cgi";
$query = new LBCGI;
&ipbanned;

if ($COOKIE_USED eq 1)
{
	$cookiepath = "";
}
else
{
	$boardurltemp = $boardurl;
	$boardurltemp =~ s/http\:\/\/(\S+?)\/(.*)/\/$2/;
	$cookiepath = $boardurltemp;
	$cookiepath =~ s/\/$//;
}

$inforum = $query->param("forum");
$intopic = $query->param("topic");
&error("打开文件&老大,别乱黑我的程序呀!") if ($inforum !~ /^[0-9]+$/);
&error("打开文件&老大,别乱黑我的程序呀!") if ($intopic !~ /^[0-9]+$/);

require "${lbdir}data/style${inforum}.cgi" if (-e "${lbdir}data/style${inforum}.cgi");
&error("普通错误&对不起,本论坛不允许新闻方式快速阅读!") if ($canuseview eq "no");
if (($mainoff == 1)||($mainonoff == 1)) { &InMaintenance; }

$inmembername = $query->cookie("amembernamecookie");
$inpassword = $query->cookie("apasswordcookie");
$inmembername =~ s/[\a\f\n\e\0\r\t\`\~\!\@\#\$\%\^\&\*\(\)\+\=\\\{\}\;\'\:\"\,\.\/\<\>\?]//isg;
$inpassword =~ s/[\a\f\n\e\0\r\t\|\@\;\#\{\}\$]//isg;

if ($useadscript ne 0)
{
	$adscript = &HTML($adscript);
	$adscript =~ s/\$imagesurl/$imagesurl/isg;
}
else
{
	$adscript = "";
}
if ($useadfoot ne 0)
{
	$adfoot = &HTML($adfoot);
	$adfoot =~ s/\$imagesurl/$imagesurl/isg;
}
else
{
	$adfoot = "";
}

$nodisp = $query->cookie("nodisp");
(undef, undef, $nodispphoto) = split(/\|/, $nodisp);

$banfresh1 = $query->cookie("banfresh");
$banfresh1 = 0 if ($banfresh1 eq "");
($backtopic, $banfresh) = split(/=/, $banfresh1);
$currenttime = time;
$banfreshcookie = cookie(-name=>"banfresh", -value=>"$intopic=$currenttime", -path=>"$cookiepath/");

if ($currenttime - $banfresh - 1 <= $banfreshtime && $backtopic eq $intopic)
{
	print header(-cookie=>[$banfreshcookie], -charset=>gb2312);
	print "服务器忙,请 $banfreshtime 秒后按刷新键继续。<br><br>";
	print "出错原因:你刷新页面过快,或者你打开了过多窗口来浏览本网站。";
	exit;
}

&getoneforum($inforum);

if ($inmembername eq "" or $inmembername eq "客人")
{
	$inmembername = "客人";
	$myrating = -1;
	$mymembercode = "no";
}
else
{
	&getmember($inmembername);
	&error("普通错误&用户没有登录或注册!") if ($userregistered eq "no");
	&error("普通错误&密码与用户名不相符,请重新登录!") if ($inpassword ne $password);
	$mymembercode = $membercode;
	$myinmembmod = $inmembmod;
	$myrating = $rating;
	$tempaccess = "forumsallowed" . $inforum;
	$testentry = $query->cookie($tempaccess);
	$allowed = $allowedentry{$inforum} eq "yes" || ($testentry eq $forumpass && $testentry ne "") || $mymembercode eq "ad" || $mymembercode eq "smo" || $myinmembmod eq "yes" ? "yes" : "no";
	&getlastvisit;
	$forumlastvisit = $lastvisitinfo{$inforum};
	&setlastvisit("$inforum,$currenttime");
}
$addtimes = ($timedifferencevalue + $timezone) * 3600;

&error("进入会员论坛查看帖子内容&您是客人没有权限进入!") if ($inmembername eq "客人" && $regaccess eq "on");
&error("进入私有论坛&对不起,您没有权限进入该私有论坛!") if ($privateforum eq "yes" && $allowed ne "yes");
if (($startnewthreads eq "cert")&&(($membercode ne "ad" && $membercode ne "smo" && $membercode ne "cmo" && $membercode ne "mo" && $membercode ne "rz")||($inmembername eq "客人"))&&($userincert eq "no")) { &error("进入论坛&你一般会员不允许进入此论坛!"); }

print header(-cookie=>[$tempvisitcookie, $permvisitcookie, $banfreshcookie], -charset=>gb2312);

&error("打开主题&这个主题不存在!可能已经被删除!") unless (-e "${lbdir}forum${inforum}/${intopic}.thd.cgi");

opendir(DIR2, "${imagesdir}usr/$inforum");
my @dirdata2 = readdir(DIR2);
closedir(DIR2);
my @files11 = grep(/^$inforum\_$intopic\_/, @dirdata2);

my $filetoopen = "$lbdir" . "boarddata/list$inforum.cgi";
my $filetoopens = &lockfilename($filetoopen);
unless (-e "${filetoopens}.lck")
{
	&winlock($filetoopen) if ($OS_USED eq "Unix" || $OS_USED eq "Nt");
	open(FILE, $filetoopen);
	flock(FILE, 1) if ($OS_USED eq "Unix");
	my @allthreads = <FILE>;
	close(FILE);
	undef @allthreadtemp;
	foreach $line (@allthreads)
	{
		chomp($line);
		next if ($line eq "");
		my ($tempno, $trash) = split(/\t/, $line);
		if ($intopic eq $tempno)
		{
			(my $topicid, my $topictitle, my $topicdescription, $threadstate, my $threadposts, $threadviews, my $startedby, my $startedpostdate, my $lastposter, my $lastpostdate, my $posticon, my $posttemp) = split(/\t/, $line);
			$threadviews++;
			$linetokeep = "$topicid\t$topictitle\t$topicdescription\t$threadstate\t$threadposts\t$threadviews\t$startedby\t$startedpostdate\t$lastposter\t$lastpostdate\t$posticon\t$posttemp";
			push(@allthreadtemp, $linetokeep);
		}
		else
		{
			push(@allthreadtemp, $line);
		}
	}
	open(FILE, ">$filetoopen");
	flock(FILE, 2) if ($OS_USED eq "Unix");
	foreach (@allthreadtemp)
	{
		print FILE "$_\n" if ($_ ne "");
	}
	close(FILE);
	&winunlock($filetoopen) if ($OS_USED eq "Unix" || $OS_USED eq "Nt");
	if (int(rand(3)) eq 2 || $threadviews < 30 || $#allthreadtemp < 6)
	{
		open(MSG, ">${lbdir}forum${inforum}/${intopic}.pl");
		print MSG $linetokeep;
		close(MSG);
	}
}
open(FILE, "${lbdir}forum${inforum}/${intopic}.thd.cgi");
@threads = <FILE>;
close(FILE);

if ($mymembercode eq "ad" || $mymembercode eq "smo" || $myinmembmod eq "yes")
{
	$viewhide = 1;
}
else
{
	$viewhide = 0;
	if ($hidejf eq "yes" )
	{
		my @viewhide = grep(/^$inmembername\t/i, @threads);
		$viewhide = @viewhide;
		$viewhide = 1 if ($viewhide > 1);
	}
}
$StartCheck = $numberofposts + $numberofreplys;

($membername, $topictitle, $postipaddresstemp, $showemoticons, $showsignature, $postdate, $post, $posticon) = split(/\t/, $threads[0]);
$topictitle =~ s/^*#!&*//;
$postdate = &dateformat($postdate + $addtimes);
&getmembernolock($membername);
$inmembmod = $forummodnamestemp =~ /,$membername,/i ? "yes" : "no";
          	       
if (($post =~ /#Moderation Mode/i && ($inmembmod eq "yes" || $membercode eq "ad" || $membercode eq "smo")) || $htmlstate eq "on")
{
	$post =~ s/#Moderation Mode/***** 版主模式 *****\<br\>/g;
	$post =~ s/&lt;/</g;
	$post =~ s/&gt;/>/g;
	$post =~ s/&quot;/\"/g;
}
else
{
	$post =~ s/style/\&\#115\;tyle/isg;
}

$addmefile = 0;
my @files2 = grep(/^$inforum\_$intopic\./, @dirdata2);
if (@files2 > 0)
{
	my $files2s = $files2[0];
	($up_name, $up_ext) = split(/\./, $files2s);
	$up_ext =~ tr/A-Z/a-z/;
	$addmefile = 1;
}
undef @dirdata2;

if ($addmefile == 1)
{
	@fileinfo = stat("${imagesdir}usr/${inforum}/${up_name}.${up_ext}");
	$filetype = "unknow";
	$filetype = $up_ext if (-e "${imagesdir}icon/${up_ext}.gif");
	if ($up_ext eq "gif" || $up_ext eq "jpg" || $up_ext eq "png" || $up_ext eq "bmp")
	{
		if ($nodispphoto eq "yes" || $arrawpostpic eq "off")
		{
			$addme = qq~<a href=$imagesurl/usr/$inforum/$up_name.$up_ext target=_blank><img src=$imagesurl/icon/$filetype.gif border=0 width=16></a> <a href=$imagesurl/usr/$inforum/$up_name.$up_ext target=_blank>点击显示此主题相关图片</a><br><br>~;
		}
		else
		{
			$addme = qq~<img src=$imagesurl/icon/$filetype.gif border=0 width=16> 此主题相关图片如下:<br><a href=$imagesurl/usr/$inforum/$up_name.$up_ext target=_blank><img src=$imagesurl/usr/$inforum/$up_name.$up_ext border=0 alt="按此在新窗口浏览图片" onload="javascript: if(this.width > screen.width - 333) this.width = screen.width - 333"></a><br><br>~;
		}
	}
	elsif ($up_ext eq "swf")
	{
		if ($arrawpostflash eq "on")
		{
			$addme = qq~<img src=$imagesurl/icon/$filetype.gif border=0 width=16> 该主题有一个 $up_ext 格式 Flash 动画 (共 $fileinfo[7] 字节)<br><br><param name=play value=true><param name=loop value=true><param name=quality value=high><embed src=$imagesurl/usr/$inforum/$up_name.$up_ext quality=high width=410 height=280 pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed><br>&nbsp;<img src=$imagesurl/images/fav.gif width=16> <a href=$imagesurl/usr/$inforum/$up_name.$up_ext target=_blank>全屏观看</a> (按右键下载)<br><br>~;
		}
		else
		{
			$addme = qq~<a href=$imagesurl/usr/$inforum/$up_name.$up_ext target=_blank><img src=$imagesurl/icon/$filetype.gif border=0 width=16 height=16>点击欣赏 Flash 动画</a>~;
		}
	}
	else
	{
		$addme = qq~<font color=$fonthighlight>相关附件</font>:<a href=$imagesurl/usr/$inforum/$up_name.$up_ext target=_blank><img src=$imagesurl/icon/$filetype.gif border=0 width=16 alt="该主题有一个“$filetype”类型附件,点击下载"></a> (共 $fileinfo[7] 字节)<br><br>~;		
	}
}
else
{
	$addme = "";
}

$PollHidden = $post =~ m/\[hidepoll\]/isg ? "yes" : "no";
$post =~ s/\[hidepoll\]//isg;

if ($idmbcodestate eq "on")
{
	$rn = 1;
	$post = &lbcode($post);
	if ($post =~/<blockquote><font face=宋体>代码/isg)
	{
		$post =~ s/\&amp\;/\&/ig;
		$post =~ s/\&lt\;br\&gt\;/<br>/ig;
	}
}
if ($emoticons eq "on" && $showemoticons eq "yes")
{
	$post = &doemoticons($post);
	$post = &smilecode($post);
}
$post = &postwordfilter($post) if ($dofilter eq "no" || $dofilter eq "all");

$memberfilename = $membername;
$memberfilename =~ s/ /\_/g;
$memberfilename = uri_escape($memberfilename) if ($uri_escape ne "no");
$homepage =~ s/^http\:\/\///isg;
$homepage = $homepage ne "" ? "http://$homepage" : "leoboard.cgi";
		
$posticon =~ s/\s//isg;
if ($posticon ne "")
{
	if ($posticon =~ /<br>/i)
	{
		$showsignature = "yes25" if ($showsignature eq "yes");
		$polltype = $showsignature =~ /^yes[0-9]+$/ ? "checkbox" : "radio";

		$posticon =~ s/<br><br>/<br>/isg;
		$posticon =~ s/<br>/\t/ig;
		my @temppoll = split(/\t/, $posticon);
		if ($#temppoll >= 1)
		{
			$maxpolllength = 0;
			@poll = split(/\t/, $posticon);
			unshift(@poll, "");
			$j = 0;
			$pollinput = "";
			for ($i = 1; $i <= 25; $i++)
			{
				if ($poll[$i] ne "")
				{
					$j++;
					$pollinput .= qq~<input type=$polltype name=myChoice value="$i"> $poll[$i]<br>~;
					$maxpolllength = length($poll[$i]) if (length($poll[$i]) > $maxpolllength);
				}
			}
			$maxpolllength = $maxpolllength * 7 + 10;
			$maxpolllength = 150 if ($maxpolllength < 150);
			$maxpolllength = 510 if ($maxpolllength > 510);
			if ($showsignature =~ /^yes[0-9]+$/)
			{
				$showsignature =~ s/^yes//;
				$maxcanpoll = "最多可投 $showsignature 项<br>";
			}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -