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

📄 post_info.asp

📁 代码名称: Snitz Forums 2000 代码语言: 英文 代码类型: 国外代码 运行环境: ASP 授权方式: 免费代码 代码大小: 530kb 代码等级: 3 整
💻 ASP
📖 第 1 页 / 共 5 页
字号:
			if strReplyAuthor = intAdminMemberID and MemberID <> intAdminMemberID then
				Go_Result "Only the Forum Admin can change this post", 0
			end if
		case 4 '## Admin so OK
			if strReplyAuthor = intAdminMemberID and MemberID <> intAdminMemberID then
				Go_Result "Only the Forum Admin can change this post", 0
			end if
		case else 
			Go_Result cstr(Member), 0
			Response.End
	end select

	txtMessage = ChkString(Request.Form("Message"),"message")
	Err_Msg = ""

	if txtMessage = " " then 
		Err_Msg = Err_Msg & "<li>You Must Enter a Message for your Reply</li>"
	end if
	if Err_Msg = "" then
		'## Forum_SQL - Do DB Update
		strSql = "UPDATE " & strActivePrefix & "REPLY "
		strSql = strSql & " SET R_MESSAGE = '" & txtMessage & "'"
		if Request.Form("sig") = "yes" and strDSignatures = "1" then
		 	strSql = strSql & ", R_SIG = 1"
		else
			strSql = strSql & ", R_SIG = 0"
		end if
		if mLev < 4 and strEditedByDate = "1" then
			strSql = strSql & ", R_LAST_EDIT = '"  & DateToStr(strForumTimeAdjust) & "'"
			strSql = strSql & ", R_LAST_EDITBY = "  & MemberID
		end if
		strSql = strSql & " WHERE REPLY_ID=" & Reply_ID

		my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

		if mLev <> 4 and Moderation = "No" then
			'## Forum_SQL - Update Last Post
			strSql = " UPDATE " & strTablePrefix & "FORUM"
			strSql = strSql & " SET F_LAST_POST = '" & DateToStr(strForumTimeAdjust) & "'"
			strSql = strSql & ",    F_LAST_POST_AUTHOR = " & MemberID
			strSql = strSql & ",    F_LAST_POST_TOPIC_ID = " & Topic_ID
			strSql = strSql & ",    F_LAST_POST_REPLY_ID = " & Reply_ID
			strSql = strSql & " WHERE FORUM_ID = " & Forum_ID

			my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords

			'## Forum_SQL - Update Last Post
			strSql = " UPDATE " & strActivePrefix & "TOPICS"
			strSql = strSql & " SET T_LAST_POST = '" & DateToStr(strForumTimeAdjust) & "'"
			strSql = strSql & ",    T_LAST_POST_AUTHOR = " & MemberID
			strSql = strSql & ",    T_LAST_POST_REPLY_ID = " & Reply_ID
			strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID

			my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
		end if

		if Moderation = "No" then
			'## Subscribe checkbox start ##
			if request.form("TNotify") <> "" then
				if request.form("TNotify") = "1" then
					AddSubscription "TOPIC", MemberID, Cat_ID, Forum_ID, Topic_ID
				else
					DeleteSubscription "TOPIC", MemberID, Cat_ID, Forum_ID, Topic_ID
				end if
			end if
			'## Subscribe checkbox end ##
		end if

		err_Msg = ""
		if Err.description <> "" then 
			Go_Result "There was an error = " & Err.description, 0
			Response.End
		else
			Go_Result "Updated OK", 1
		end if
	else 
		Response.Write	"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>There Was A Problem With Your Details</font></p>" & vbNewLine & _
				"      <table align=""center"" border=""0"">" & vbNewLine & _
				"        <tr>" & vbNewLine & _
				"          <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """><ul>" & Err_Msg & "</ul></font></td>" & vbNewLine & _
				"        </tr>" & vbNewLine & _
				"      </table>" & vbNewLine & _
				"      <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""JavaScript:history.go(-1)"">Go Back To Enter Data</a></font></p>" & vbNewLine
	end if
end if

if MethodType = "EditTopic" then
	member = cLng(ChkUser(strDBNTUserName, strPassword, strTopicAuthor))
	select case Member 
		case 0 '## Invalid Pword
			Go_Result "Invalid Password or UserName", 0
			Response.End
		case 1 '## Author of Post so OK
			'## Do Nothing
		case 2 '## Normal User - Not Authorised
			Go_Result "Only an Admin, a Moderator or the Author can change this post", 0
			Response.End
		case 3 '## Moderator so 
			if chkForumModerator(Forum_ID, strDBNTUserName) = "0" then
				Go_Result "Only an Admin, a Moderator or the Author can change this post", 0
			end if
			if strTopicAuthor = intAdminMemberID and MemberID <> intAdminMemberID then
				Go_Result "Only the Forum Admin can change this post", 0
			end if
		case 4 '## Admin so OK
			if strTopicAuthor = intAdminMemberID and MemberID <> intAdminMemberID then
				Go_Result "Only the Forum Admin can change this post", 0
			end if
			'## Do Nothing
		case else 
			Go_Result cstr(Member), 0
			Response.End
	end select

	txtMessage = chkString(Request.Form("Message"),"message")
	txtSubject = chkString(Request.Form("Subject"),"SQLString")
	if strBadWordFilter = "1" then
		txtSubject = chkString(ChkBadWords(Request.Form("Subject")),"SQLString")
	end if
	Err_Msg = ""

	if txtSubject = " " then 
		Err_Msg = Err_Msg & "<li>You Must Enter a Subject for the Topic</li>"
	end if
	if Len(Request.Form("Subject")) > 50 then 
		Err_Msg = Err_Msg & "<li>The Subject can not be greater than 50 characters</li>"
	end if
	if txtMessage = " " then 
		Err_Msg = Err_Msg & "<li>You Must Enter a Message for the Topic</li>"
	end if
	if Err_Msg = "" then
		'##Get Status of this Topic
		strSql = "SELECT T_STATUS, T_UREPLIES"
		strSql = Strsql & " FROM " & strTablePrefix & "TOPICS "
		strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID

		set rsTopicStatusCheck = my_Conn.Execute (strSql)

		Topic_Status = rsTopicStatusCheck("T_STATUS")
		Topic_UReplies = rsTopicStatusCheck("T_UREPLIES")

		rsTopicStatusCheck.Close
		set rsTopicStatusCheck = nothing

		'## Set array to pull out CAT_ID and FORUM_ID from dropdown values in post.asp
		aryForum = split(Request.Form("Forum"), "|")

		'## if the forum we are moving to doesn't have MODERATION, and this topic did have that
		'## we are going to have to auto-approve the topic !

		AutoApprove = "No"
		Moderation = "No"

		if Forum_ID <> cLng(aryForum(1)) then
			blnTopicMoved = true
			strSql = "SELECT " & strTablePrefix & "FORUM.F_MODERATION "
			strSql = strsql & " FROM " & strTablePrefix & "FORUM "
			strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & Forum_ID

			set rsForumCheck = my_Conn.Execute (strSql)

			ForumModeration = rsForumCheck("F_MODERATION")

			rsForumCheck.Close
			set rsForumCheck = nothing
		
			'## Is Moderation allowed on the topic in the old forum ?
			if (ForumModeration = 1 or ForumModeration = 2) then
				Moderation = "Yes"
			end if

			if Moderation = "Yes" and Topic_Status > 0 then
	
				strSql = "SELECT " & strTablePrefix & "FORUM.F_MODERATION "
				strSql = Strsql & " FROM " & strTablePrefix & "FORUM "
				strSql = strSql & " WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & cLng(aryForum(1))

				set rsNewForumCheck = my_Conn.Execute (strSql)

				NewForumModeration   = rsNewForumCheck("F_MODERATION")

				rsNewForumCheck.Close
				set rsNewForumCheck = nothing

				'## Is Moderation allowed on the topic in the new forum ?
				if not(NewForumModeration = 1 or NewForumModeration = 2) then
					AutoApprove = "Yes"
				end if
			end if
		end if

		if Moderation = "Yes" and AutoApprove = "Yes" and Topic_UReplies > 0 then
			Go_Result "There was an error = The Topic you are attempting to move to an UnModerated Forum has UnModerated Replies<br />Please either approve or delete them and then try again.", 0
			Response.End
		end if

		'## Forum_SQL
		strSql = "UPDATE " & strActivePrefix & "TOPICS "
		strSql = strSql & " SET T_MESSAGE = '" & txtMessage & "'"
		strSql = strSql & ", T_SUBJECT = '" & txtSubject & "'"
		if blnTopicMoved then
			strSql = strSql & ", CAT_ID = " & cLng(aryForum(0))
			strSql = strSql & ", FORUM_ID = " & cLng(aryForum(1))
			if AutoApprove = "Yes" then
				strSql = strSql & ", T_STATUS = 1 "
			end if
		end if
		if Request.Form("sig") = "yes" and strDSignatures = "1" then
		 	strSql = strSql & ", T_SIG = 1"
		else
			strSql = strSql & ", T_SIG = 0"
		end if
		if mLev < 4 and strEditedByDate = "1" then
			strSql = strSql & ", T_LAST_EDIT = '"  & DateToStr(strForumTimeAdjust) & "'"
			strSql = strSql & ", T_LAST_EDITBY = "  & MemberID
		end if                                                   
		if ForumChkSkipAllowed = 1 then
			if Request.Form("sticky") = 1 then
				strSql = strSql & ", T_STICKY = " & 1
				strSql = strSql & ", T_ARCHIVE_FLAG = " & 0
			else
				strSql = strSql & ", T_STICKY = " & 0
				strSql = strSql & ", T_ARCHIVE_FLAG = " & 1
			end if
		end if
		strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID

		my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords

		'# Subscribe checkbox start ##
		if request.form("TNotify") <> "" then
			if request.form("TNotify") = "1" then
				AddSubscription "TOPIC", MemberID, Cat_ID, Forum_ID, Topic_ID
			elseif request.form("TNotify") = "0" then
				DeleteSubscription "TOPIC", MemberID, Cat_ID, Forum_ID, Topic_ID
			end if
		end if
		'## Subscribe checkbox end ##

		if blnTopicMoved then
			if strEmail = "1" and strMoveNotify = "1" then DoAutoMoveEmail(Topic_ID)	
			strSQL = "SELECT F_SUBSCRIPTION FROM " & strTablePrefix & "FORUM WHERE FORUM_ID=" & cLng(aryForum(1))
			set rs = my_conn.execute (strSQL)
			if rs("F_SUBSCRIPTION") < 3 then
				strSQL = "DELETE FROM " & strTablePrefix & "SUBSCRIPTIONS WHERE TOPIC_ID=" & Topic_ID
				my_conn.execute(strSQL),,adCmdText + adExecuteNoRecords
			end if
			rs.close
		end if
		if Forum_ID <> cLng(aryForum(1)) then
			'## Forum_SQL
			strSql = "UPDATE " & strActivePrefix & "REPLY "
			strSql = strSql & " SET CAT_ID = " & cLng(aryForum(0))
			strSql = strSql & ", FORUM_ID = " & cLng(aryForum(1))
			strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID

			my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
			
			set rs = Server.CreateObject("ADODB.Recordset")
			
			'## if the topic hasn't been approved yet, it isn't counted either
			'## so then the topic count doesn't need to be updated

	        	if Moderation = "No" or AutoApprove = "Yes" or Topic_Status < 2 then

				'## Forum_SQL - count total number of replies in Topics table
				strSql = "SELECT T_REPLIES, T_LAST_POST, T_LAST_POST_AUTHOR "
				strSql = strSql & " FROM " & strActivePrefix & "TOPICS "
				strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID

				set rs = my_Conn.Execute (strSql)
			
				intResetCount = rs("T_REPLIES") + 1
				strT_Last_Post = rs("T_LAST_POST")
				strT_Last_Post_Author = rs("T_LAST_POST_AUTHOR")
			
				rs.Close
				set rs = nothing

				'## Forum_SQL - Get last_post and last_post_author for MoveFrom-Forum
				strSql = "SELECT TOPIC_ID, T_LAST_POST, T_LAST_POST_AUTHOR, T_LAST_POST_REPLY_ID "
				strSql = strSql & " FROM " & strActivePrefix & "TOPICS "
				strSql = strSql & " WHERE FORUM_ID = " & Forum_ID & " "
				strSql = strSql & " ORDER BY T_LAST_POST DESC;"

				set rs = my_Conn.Execute (strSql)
			
				if not rs.eof then
					strLast_Post_Topic_ID = rs("TOPIC_ID")
					strLast_Post = rs("T_LAST_POST")
					strLast_Post_Author = rs("T_LAST_POST_AUTHOR")
					strLast_Post_Reply_ID = rs("T_LAST_POST_REPLY_ID")
				else
					strLast_Post_Topic_ID = 0
					strLast_Post = ""
					strLast_Post_Author = 0
					strLast_Post_Reply_ID = 0
				end if
			
				rs.Close
				set rs = nothing

		        	if Moderation = "No" or Topic_Status < 2 then
					'## Forum_SQL - Update count of replies to a topic in Forum table

					strSql = "UPDATE " & strTablePrefix & "FORUM SET "
					strSql = strSql & " F_COUNT = F_COUNT - " & intResetCount
					strSql = strSql & " WHERE FORUM_ID = " & Forum_ID
					my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords

					'## Forum_SQL
					strSql =  "UPDATE " & strTablePrefix & "FORUM SET "
					strSql = strSql & " F_TOPICS = F_TOPICS - 1 "
					strSql = strSql & " WHERE FORUM_ID = " & Forum_ID
					my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords

				end if 

				strSql = "UPDATE " & strTablePrefix & "FORUM SET "
				'if strLast_Post <> "" then 
					strSql = strSql & "F_LAST_POST = '" & strLast_Post & "'"
					'if strLast_Post_Author <> "" then 
						strSql = strSql & ", F_LAST_POST_AUTHOR = " & strLast_Post_Author
					'end if
				'end if
				strSql = strSql & ", F_LAST_POST_TOPIC_ID = " & strLast_Post_Topic_ID
				strSql = strSql & ", F_LAST_POST_REPLY_ID = " & strLast_Post_Reply_ID
				strSql = strSql & " WHERE FORUM_ID = " & Forum_ID
				my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords

				'## Forum_SQL - Get last_post and last_post_author for Forum
				strSql = "SELECT TOPIC_ID, T_LAST_POST, T_LAST_POST_AUTHOR, T_AUTHOR, T_LAST_POST_REPLY_ID "
				strSql = strSql & " FROM " & strActivePrefix & "TOPICS "
				strSql = strSql & " WHERE FORUM_ID = " & cLng(aryForum(1))
				strSql = strSql & " ORDER BY T_LAST_POST DESC;"

⌨️ 快捷键说明

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