classforum.asp

来自「依蓝旅游网站管理系统Elan2008.SP2」· ASP 代码 · 共 1,287 行 · 第 1/5 页

ASP
1,287
字号
			UserID = EL_User.UserID
			UserName = EL_User.UserName
	  End Select
	  
	  Call EL_Common.InitCommand(NewTopicCmd, "EL_SP_Topic")
	  With NewTopicCmd
	     .Parameters.Append .CreateParameter("RETURN", 2, 4)
		 .Parameters.Append .CreateParameter("@UpdateType", 3, 1, 4, UpdateType)
		 If UpdateType = 0 Then
		    .Parameters.Append .CreateParameter("@TopicID", 3, 2, 4)
		 Else
		    .Parameters.Append .CreateParameter("@TopicID", 3, 1, 4, TopicID)
		 End If
		 .Parameters.Append .CreateParameter("@ParentID", 3, 1, 4, ParentID)
		 .Parameters.Append .CreateParameter("@BoardID", 3, 1, 4, EL_Board.BoardID)
		 .Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		 .Parameters.Append .CreateParameter("@Title", 200, 1, 255, Title)
		 .Parameters.Append .CreateParameter("@TopicType", 3, 1, 4, TopicType)
		 .Parameters.Append .CreateParameter("@UserID", 3, 1, 4, UserID)
		 .Parameters.Append .CreateParameter("@UserName", 200, 1, 50, UserName)
		 .Parameters.Append .CreateParameter("@Color", 200, 1, 10, Color)
		 .Parameters.Append .CreateParameter("@Icon", 3, 1, 4, Icon)
		 .Parameters.Append .CreateParameter("@Content", 203, 1, EL_Common.LenParameter(Content), Content)
		 .Parameters.Append .CreateParameter("@Uploadfiles", 203, 1, EL_Common.LenParameter(Uploadfiles), Uploadfiles)
		 .Parameters.Append .CreateParameter("@IpAddress", 200, 1, 15, RemoteIp)
		 .Parameters.Append .CreateParameter("@VoteItems", 200, 1, 500, VoteItems)
		 .Parameters.Append .CreateParameter("@VoteTimeOut", 135, 1, 8, VoteTimeOut)
		 .Parameters.Append .CreateParameter("@VoteType", 3, 1, 4, VoteType)
		 .Execute()
	  End With
	  Session("CheckCode") = ""
	  Select Case NewTopicCmd(0)
	     Case 40:
		    EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error1", "指定版面不存在或已被禁用"))
			Set NewTopicCmd = Nothing
			Exit Sub
		 Case 41:
		    EL_Common.ShowErrorMsg(EL_Common.Lang("User.Error14", "您使用的帐户有误,如有问题请与管理员联系"))
			Set NewTopicCmd = Nothing
			Exit Sub
		 Case 42:
		    EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error2", "指定帖子不存在或已被管理员删除"))
			Set NewTopicCmd = Nothing
			Exit Sub
		 Case 43:
		    EL_Common.ShowErrorMsg(EL_Common.Lang("Vote.Error1", "指定调查不存在"))
			Set NewTopicCmd = Nothing
			Exit Sub
		 Case 44:
		    EL_Common.ShowErrorMsg(EL_Common.Lang("Vote.Error2", "对不起,您已经投过票"))
			Set NewTopicCmd = Nothing
			Exit Sub
	  End Select
	  
	  Dim BackURL, ReplyPageSizes, Replys, PageNum, PostDateTime
	  ReplyPageSizes = EL_Common.ELClng(EL_Common.Lang("Forum.ReplyPageSizes", 10))
	  Select Case Action
	     Case "SaveNew":
		    TopicID = NewTopicCmd(2)
			BackURL = InstallDir & EL_Channel.ChannelDir &"/ShowTopic.asp?BoardID="& EL_Board.BoardID &"&TopicID="& TopicID
		 Case "SaveReply":
		    Replys = EL_Topic.Replys	
			Replys = Replys + 2	'回复数+主题+新回复
			If Replys > ReplyPageSizes Then
			   PageNum = Replys / ReplyPageSizes
			   If PageNum > Int(PageNum) Then
			      PageNum = Int(PageNum) + 1
			   Else
			      PageNum = Int(PageNum)
			   End If
			Else
			   PageNum = 1   
			End If
		    TopicID = NewTopicCmd(2)
			BackURL = InstallDir & EL_Channel.ChannelDir &"/ShowTopic.asp?BoardID="& EL_Board.BoardID &"&TopicID="& ParentID &"&page="& PageNum &"#"& TopicID
		 Case "SaveEdit":
		    If ParentID = 0 Then
			   BackURL = InstallDir & EL_Channel.ChannelDir &"/ShowTopic.asp?BoardID="& EL_Board.BoardID &"&TopicID="& TopicID
			Else
			   Replys = EL_Common.GetFieldValue("COUNT(TopicID)", "EL_ForumTopic", "ChannelID="& ChannelID &" AND BoardID="& EL_Board.BoardID &" AND Deleted="& EL_False &" AND ParentID="& ParentID &" AND PostDateTime<='"& EL_Topic.PostDateTime &"'")
			   Replys = Replys + 1
			   If Replys > ReplyPageSizes Then
			      PageNum = Replys / ReplyPageSizes
			      If PageNum > Int(PageNum) Then
			         PageNum = Int(PageNum) + 1
			      Else
			         PageNum = Int(PageNum)
			      End If
			   Else
			      PageNum = 1   
			   End If 
			   BackURL = InstallDir & EL_Channel.ChannelDir &"/ShowTopic.asp?BoardID="& EL_Board.BoardID &"&TopicID="& ParentID &"&page="& PageNum &"#"& TopicID
			End If
	     Case "SaveVote":
		    Response.Redirect ComeURL
	  End Select	  
	  
	  HTML = EL_Common.Template(ChannelID, 26, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", EL_Common.Lang("Forum.SendTopic", "发表主题"))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, EL_Board.BoardID, EL_Board.SkinID))
	  
	  StrPath = EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;&nbsp;")
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"'>"& EL_Channel.ChannelName &"</a>"
	  If EL_Board.ParentID <> 0 Then
	     EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/ShowBoard.asp?BoardID="& EL_Board.ParentID &"'>"& EL_Board.ParentName &"</a>"
	  End If
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/ShowBoard.asp?BoardID="& EL_Board.BoardID &"'>"& EL_Board.BoardName &"</a>"
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath & EL_Common.Lang("Forum.SendTopic", "发表主题")
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  HTML = ChannelCommonLabels(HTML)
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$BackURL}", BackURL)
	  
	  Set NewTopicCmd = Nothing
	  Set EL_Board = Nothing
	  Set EL_Topic = Nothing
	  Session("EL_Forum_LastPostDateTime") = Now()
	  Response.Write HTML
   End Sub
   
   Public Sub NewTopic()   
      If EL_User.UserIsLogin = False Then
	     Dim TempURL
		 TempURL = InstallDir & EL_Channel.ChannelDir &"/"& EL_CurrentScriptName
		 If Request.ServerVariables("QUERY_STRING") <> "" Then
		    TempURL = TempURL  &"?"& Request.ServerVariables("QUERY_STRING")
		 End If
		 Response.Redirect InstallDir &"User/User_Login.asp?url="& EL_Common.ServerURLEncode(TempURL)
	  End If
	  
	  If EL_User.EnablePost = False Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error3", "对不起,您被禁止发帖"))
		 Exit Sub
	  End If
	  	  	  
      Dim EL_Board, EL_Topic
	  Dim Form_Action, Form_UserName, StrPath, ActionTitle, ReplyID, ArrTemp
	  Dim TopicID, Title, Color, Icon, Content, Uploadfiles, TopicType
	  Set EL_Board = New ClassBoard
	  If EL_Board.ErrorCode = 1 Then
	     Set EL_Board = Nothing
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error1", "指定"& EL_Channel.ClassItemName &"不存在或已被禁用"))
	     Exit Sub
	  End If
	  
	  Set EL_Topic = New ClassTopic
	  
	  TopicID = 0
	  Title = ""
	  Color = ""
	  Icon = 0
	  Content = ""
	  Uploadfiles =""
	  TopicType = 0
	  Form_UserName = EL_User.UserName
	  ReplyID = EL_Common.ELRequest("ReplyID", 2)
	  
	  Select Case Action
	     Case "New":
			ActionTitle = EL_Common.Lang("Forum.SendTopic", "发表帖子")
			Form_Action = "<input type='hidden' id='Action' name='Action' value='SaveNew' />"
			Form_Action = Form_Action &"<input type='hidden' id='BoardID' name='BoardID' value='"& EL_Board.BoardID &"' />"
			Form_Action = Form_Action &"<input type='hidden' id='TopicType' name='TopicType' value='0' />"
			Form_Action = Form_Action &"<input type='hidden' id='Uploadfiles' name='Uploadfiles' value='' />"
		 Case "Vote":
		    ActionTitle = EL_Common.Lang("Forum.SendTopic", "发表帖子")
		    TopicType = 1
		    Form_Action = "<input type='hidden' id='Action' name='Action' value='SaveNew' />"
			Form_Action = Form_Action &"<input type='hidden' id='BoardID' name='BoardID' value='"& EL_Board.BoardID &"' />"
			Form_Action = Form_Action &"<input type='hidden' id='TopicType' name='TopicType' value='1' />"
			Form_Action = Form_Action &"<input type='hidden' id='Uploadfiles' name='Uploadfiles' value='' />"
		 Case "Reply":
		    ActionTitle = EL_Common.Lang("Forum.ReplyTopic", "回复帖子")
			TopicID = EL_Common.ELRequest("TopicID", 2)			
			ArrTemp = EL_Common.GetFieldValue("TopicID,Title", "EL_ForumTopic", "ChannelID="& ChannelID &" AND BoardID="& EL_Board.BoardID &" AND Deleted="& EL_False &" AND TopicID="& TopicID)
			If TopicID <> ArrTemp(0) Then
			   EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error2", "指定帖子不存在或已被管理员删除"))
			   Set EL_Board = Nothing
			   Set EL_Topic = Nothing
			End If		
			Title = ArrTemp(1)	
			Title = EL_Common.Lang("Forum.NewTopic.ReplyTitle", "回复:") & Title
			Form_Action = "<input type='hidden' id='Action' name='Action' value='SaveReply' />"
			Form_Action = Form_Action &"<input type='hidden' id='BoardID' name='BoardID' value='"& EL_Board.BoardID &"' />"
			Form_Action = Form_Action &"<input type='hidden' id='TopicType' name='TopicType' value='"& TopicType &"' />"
			Form_Action = Form_Action & "<input type='hidden' id='Uploadfiles' name='Uploadfiles' value='' />"
			Form_Action = Form_Action & "<input type='hidden' id='TopicID' name='TopicID' value='"& TopicID &"' />"
		 Case "Edit":	
		    ActionTitle = EL_Common.Lang("Forum.ModifyTopic", "编辑帖子")
			TopicID = EL_Common.ELRequest("TopicID", 2)			
			ArrTemp = EL_Common.GetFieldValue("TopicID,Title,Color,Icon,Content,Uploadfiles,TopicType,UserID,UserName", "EL_ForumTopic", "ChannelID="& ChannelID &" AND BoardID="& EL_Board.BoardID &" AND Deleted="& EL_False &" AND TopicID="& TopicID)
			If TopicID <> ArrTemp(0) Then
			   EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error2", "指定帖子不存在或已被管理员删除"))
			   Set EL_Board = Nothing
			End If
								
			If EL_User.BoardSuperManager = False Then
			   If EL_User.UserName <> ArrTemp(8) Or EL_User.UserID <> ArrTemp(7) Then
			      If EL_Common.FoundInArray(Split(EL_Board.ArrManager, "|"), EL_User.UserName) = False Then
			         EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error4", "对不起,您没有编辑的权限"))
				     Set EL_Board = Nothing
				     Exit Sub
			      End If
			   End If
			End If
				
			TopicID = ArrTemp(0)
			Title = ArrTemp(1)
			Color = ArrTemp(2)
			Icon = ArrTemp(3)
			Content = ArrTemp(4)
			Uploadfiles = ArrTemp(5)
			TopicType = ArrTemp(6)
			Form_UserName = ArrTemp(8)	
		    Form_Action = "<input type='hidden' id='Action' name='Action' value='SaveEdit' />"
			Form_Action = Form_Action &"<input type='hidden' id='BoardID' name='BoardID' value='"& EL_Board.BoardID &"' />"
			Form_Action = Form_Action &"<input type='hidden' id='TopicType' name='TopicType' value='"& TopicType &"' />"
			Form_Action = Form_Action &"<input type='hidden' id='TopicID' name='TopicID' value='"& TopicID &"' />"
			Form_Action = Form_Action &"<input type='hidden' id='Uploadfiles' name='Uploadfiles' value='"& Uploadfiles &"' />"
	     Case "Quote":
		    Dim QuoteTitle, Quote_UserName, Quote_PostDateTime, Quote_Content, Quote_Locked
			
			QuoteTitle = EL_Common.Lang("Forum.QuoteTitle", "")
			ActionTitle = EL_Common.Lang("Forum.ReplyTopic", "回复帖子")
			
			TopicID = EL_Common.ELRequest("TopicID", 2)			
			ArrTemp = EL_Common.GetFieldValue("TopicID,Title,UserName,Content,PostDateTime,Locked", "EL_ForumTopic", "ChannelID="& ChannelID &" AND BoardID="& EL_Board.BoardID &" AND Deleted="& EL_False &" AND TopicID="& TopicID)
			If TopicID <> ArrTemp(0) Then
			   EL_Common.ShowErrorMsg(EL_Common.Lang("Forum.Error2", "指定帖子不存在或已被管理员删除"))
			   Set EL_Board = Nothing
			   Set EL_Topic = Nothing
			End If
			Title = EL_Common.Lang("Forum.NewTopic.ReplyTitle", "回复:") & ArrTemp(1)
			Quote_UserName = ArrTemp(2)
			Quote_Content = ArrTemp(3)
			Quote_PostDateTime = ArrTemp(4)			
			Quote_Locked = ArrTemp(5)
			If Quote_Locked Then Quote_Content = "<span style='color:#999999'>******** "& EL_Common.Lang("Forum.Error8", "此帖已被管理屏蔽") &" ********</span>"
			QuoteTitle = EL_Common.RegExpStaticLabel(QuoteTitle, "{$UserName}", Quote_UserName)
			QuoteTitle = EL_Common.RegExpStaticLabel(QuoteTitle, "{$PostDateTime}", Quote_PostDateTime)
			Content = "<p><table width=""95%"" border=""0"" align=""Center"" cellpadding=""6"" cellspacing=""0"" class=""forum_quote_tb"">"
			Content = Content &"<tr><td class=""forum_quote_title"">"
			Content = Content & QuoteTitle &"</td></tr><tr><td class=""forum_quote_content"">"& Quote_Content &"</td>"
			Content = Content &"</tr></table></p><p>&nbsp;</p>"
			Form_Action = "<input type='hidden' id='Action' name='Action' value='SaveReply' />"
			Form_Action = Form_Action &"<input type='hidden' id='BoardID' name='BoardID' value='"& EL_Board.BoardID &"' />"
			Form_Action = Form_Action &"<input type='hidden' id='TopicType' name='TopicType' value='"& TopicType &"' />"
			Form_Action = Form_Action & "<input type='hidden' id='Uploadfiles' name='Uploadfiles' value='' />"
			Form_Action = Form_Action & "<input type='hidden' id='TopicID' name='TopicID' value='"& TopicID &"' />"
	  End Select
	  
	  HTML = EL_Common.Template(ChannelID, 25, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)	  
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", ActionTitle)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))

⌨️ 快捷键说明

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