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

📄 donewpost.pl

📁 这个社区是虚拟社区使用的程序
💻 PL
字号:
###############################################################################
# DoNewPost.pl                                                                #
###############################################################################
# UltraBoard Ver. 1.61 by UltraScripts.com                                    #
# Scripts written by Jacky W.W. Yung, WebMaster@UltraScripts.com              #
# Available from http://www.UltraScripts.com/UltraBoard/                      #
# --------------------------------------------------------------------------- #
# PROGRAM NAME : UltraBoard                                                   #
# VERSION : 1.61                                                              #
# LAST MODIFIED : 30/06/1999                                                  #
# =========================================================================== #
# COPYRIGHT NOTICE :                                                          #
#                                                                             #
# Copyright (c) 1999 Jacky Yung. All Rights Reserved.                         #
#                                                                             #
# This program is free software; you can change or modify it as you see fit.  #
# However, modified versions cannot be sold or distributed.  You cannot alter #
# the copyright and "powered by" notices throughout the scripts. These        #
# notices must be clearly visible to the end users.                           #
#                                                                             #
# WARRANTY DISCLAIMER:                                                        #
#                                                                             #
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT #
# ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR       #
# FITNESS FOR A PARTICULAR PURPOSE.                                           #
###############################################################################

###############################################################################
# DoNewPost                                                                   #
###############################################################################
sub DoNewPost {
	&ShowError("粘贴错误","您必须输入主题。") if (!$in{'Subject'});
	&ShowError("粘贴错误","您必须输入内容。") if (!$in{'Message'});
	&ShowError("粘贴错误","您的主题不能多于 $MaxSubjectLen 个字符。") if (length($in{'Subject'}) > $MaxSubjectLen);
	
	unless (-e "$DBPath/$in{'Board'}/board.list") {
		&ShowError("ACCESS DENIED","The board you want to post topic is not found.<br>Please contact the webmaster (".&Link("mailto:$EmailAddress","","").$EmailAddress."</a>".") for more information.");
	}
	open(BOARD,"$DBPath/$in{'Board'}/board.list")||&CGIError("Couldn't open/read the board.list file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
		flock(BOARD,1) if ($FLock);
		$BOARD_DATA=<BOARD>;
	close(BOARD);
	@BoardInfo=&DecodeDBOutput($BOARD_DATA);
	if ($Group eq "Guest") {
		&ShowError("粘贴错误","您必须输入别名。") if (!$in{'NickName'});
		&ShowError("粘贴错误","别名最少4个字符(2个汉字),最多20个字符(10个汉字)。") if (length($in{'NickName'}) < 4);
		&ShowError("粘贴错误","别名最少4个字符(2个汉字),最多20个字符(10个汉字)。") if (length($in{'NickName'}) > 20);
################################################################################################
	open(DB,"$MembersPath/Members.nickname")||&CGIError("Couldn't open/read the Members.nickname file<br>\nPath: $MembersPath<br>\nReason : $!");
			flock(DB,1) if ($FLock);
			@REG_NickName=<DB>;
		close(DB);
		for (my($i)=0;$i<=$#REG_NickName;$i++) {
			chomp($REG_NickName[$i]);
			if ($REG_NickName[$i] =~/^$in{'NickName'}$/i) {
				&ShowError("粘贴错误","您选择的别名已经注册了。");
			}
		}
	}
###############################################################################################	
	if ($Group ne "administrator") {
		if ($BoardInfo[5] ne "Active") {
			&ShowError("ACCESS DENIED","The \"$BoardInfo[1]\" board is currently inactive.<br>Please contact the webmaster (".&Link("mailto:$EmailAddress","","").$EmailAddress."</a>".") for more information.");
		}
		if (($BoardInfo[6] ne "Public")&&($Group eq "Guest")) {
			print "Location: UltraBoard.$Ext?Action=SignIn&Ref=NewPost&Board=$in{'Board'}&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}\n\n";
		}elsif ($BoardInfo[6] eq "Private") {
			require "$DBPath/$in{'Board'}/Access.db";
			if ($Access{$MemberData[3]} ne "FullAccess") {
				print "Location: UltraBoard.$Ext?Action=SignIn&Ref=NewPost&Board=$in{'Board'}&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}\n\n";
			}
		}
	}
###############################################################################
	$PostTime = time;
	$NickName=$in{'NickName'};
	if ($in{'Method'} eq "Preview") {
		$in{'NickName'}=&RemoveCensorWords(&DecodeHTML($in{'NickName'}));
		$in{'Subject'}=&RemoveCensorWords(&DecodeHTML($in{'Subject'}));
		$in{'Description'}=&RemoveCensorWords(&DecodeHTML($in{'Description'}));
		$in{'Message'}=&RemoveCensorWords(&DecodeUBCodes(&DecodeHTML($in{'Message'})));
	}
###############################################################################
	open(COUNT,"$DBPath/$in{'Board'}/board.count")||&CGIError("Couldn't open/read the board.count file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
		flock(COUNT,1) if ($FLock);
		@COUNT_DATA=&DecodeDBOutput(<COUNT>);
	close(COUNT);
	$COUNT_DATA[0]++;
	$COUNT_DATA[1]++;
	$COUNT_DATA[2]++;
	$COUNT_DATA[3]=$PostTime;
	open(COUNT,">$DBPath/$in{'Board'}/board.count")||&CGIError("Couldn't create/write the board.count file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
		flock(COUNT,2) if ($FLock);
			print COUNT &EncodeDBInput(@COUNT_DATA);
		flock(COUNT,8) if ($FLock);
	close(COUNT);
###############################################################################
 	open(BOARD,">>$DBPath/$in{'Board'}/board.list")||&CGIError("Couldn't write the board.list file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
		flock(BOARD,2) if ($FLock);
			print BOARD &EncodeDBInput(
							$PostTime,								#Post Time
							$COUNT_DATA[0],							#Post Number
							"0",									#How many replies
							&RemoveCensorWords($in{'Subject'}),		#Subject
							&RemoveCensorWords($NickName),			#NickName
							$UserName,								#UserName
                            "",      								#Closed ?
                            &RemoveCensorWords($in{'Description'}), #Description of the message
                            $in{'TopicIcon'}                        #Topic Icon
						);
		flock(BOARD,8) if ($FLock);
	close(BOARD);
###############################################################################
	if (($ENV{'REMOTE_HOST'})&&($TrackIP=~/Host/)) {
		$IP=$ENV{'REMOTE_HOST'};
	}elsif ($TrackIP=~/IP/){
		$IP=$ENV{'REMOTE_ADDR'};
	}
	open(POST,">$DBPath/$in{'Board'}/$COUNT_DATA[0].post")||&CGIError("Couldn't create/write the $COUNT_DATA[0].post file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
		flock(POST,2) if ($FLock);
			$InLine=	&EncodeDBInput(
							&RemoveCensorWords($in{'Subject'}),						#Subject
							$NickName,												#NickName
							$UserName,												#UserName
							$in{'Nodify'},											#Nodify member when someone reply their message
							$in{'UseSignature'},									#Use Signarture in their message or not
							$PostTime,												#Post Time
							$IP														#Host/IP Address
						);
			chomp $InLine;		
			print POST	$InLine.$Spliter;

			print POST	&EncodeUBCodes(&RemoveCensorWords($in{'Message'})).$Spliter;#Message
			print POST	&EncodeDBInput(                            
							"",      												#Closed ?
                            &RemoveCensorWords($in{'Description'}),                 #Description of the message
                            "0",                                                    #Edited how many times
                            $in{'TopicIcon'}                                        #Topic Icon
						);
						
			print POST	&EncodeDBInput(
							"0","0","$PostTime"
						);
		flock(POST,8) if ($FLock);
	close(POST);

	open(VIEWIP,">$DBPath/$in{'Board'}/$COUNT_DATA[0].viewip")||&CGIError("Couldn't create/write the $COUNT_DATA[0].viewip file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
	print VIEWIP $IP;
	close(VIEWIP);
	chmod 0666,"$DBPath/$in{'Board'}/$COUNT_DATA[0].post";
	chmod 0666,"$DBPath/$in{'Board'}/$COUNT_DATA[0].viewip";
	
###############################################################################
	if ($UserName) {
		$MemberData[5]++;
		$MemberData[7]=$PostTime;
		&SaveMemberData($UserName,@MemberData);
	}
###############################################################################
	if ($NotifyPost) {
		if ($Group eq "Guest") {
			$From = "$NickName (Guest)";
		}else{
			$From = "$MemberData[1] ($MemberData[0])";
		}
		open(BOARD,"$DBPath/$in{'Board'}/board.list")||&CGIError("Couldn't open/read the board.list file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
			flock(BOARD,1) if ($FLock);
			$BOARD_DATA=<BOARD>;
		close(BOARD);
		@BoardInfo=&DecodeDBOutput($BOARD_DATA);
		open(CATEGORY,"$DBPath/$BoardInfo[3].cat")||&CGIError("Couldn't open/read the $BoardInfo[3].cat file<br>\nPath: $DBPath<br>\nReason : $!");
			flock(CATEGORY,1) if ($FLock);
			$CATEGORY_DATA=<CATEGORY>;
			@CategoryInfo=&DecodeDBOutput($CATEGORY_DATA);
		close(CATEGORY);
		my ($Subject) = "新的讨论被粘贴----$UBName";
		my ($Message) = "您好,\n";
			$Message .= "$From 粘贴了一个新讨论,时间 ".gmtime($PostTime+($GMTOffset*3600))."\n\n";
			$Message .= "下面是详细信息:\n";
			$Message .= "----------------------------------------\n";
			$Message .= "来自: $From\n";
			$Message .= "粘贴于: $CategoryInfo[1] / @BoardInfo[1]\n";
			$Message .= "Host/IP: $IP\n";
			$Message .= "电子邮件: $MemberData[4]\n\n";
			$Message .= "主题: $in{'Subject'}\n";
			$Message .= "内容:\n$in{'Message'}\n";
			$Message .= "----------------------------------------\n";
			$Message .= "$UBName Administrator Center\n";
		&SendMail($EmailAddress,$Subject,$Message,$EmailAddress);
	}
###############################################################################
	&ShowThank(	"粘贴新讨论",
				"您的讨论已经在 $BoardInfo[1] 粘贴。\n",
				"3",
				"UltraBoard.$Ext?Action=ShowPost&Board=$in{'Board'}&Post=$COUNT_DATA[0]&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}&Session=$SessionID"				
	);
	exit;
}
###############################################################################
1;# End of DoNewPost Function
###############################################################################

⌨️ 快捷键说明

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