classforum.asp

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

ASP
1,287
字号
<%
Class ClassForum
   Private HTML, CommonRegExp, EL_Channel, ReplaceKeyType
   Private CurrentPage, URLParameters
   
   Private Sub Class_Initialize
      Set CommonRegExp = New RegExp
	  CommonRegExp.IgnoreCase = True 
      CommonRegExp.Global = True 
	  Set EL_Channel = New ClassChannel	 
	  EL_Channel.GetChannelConfig()	  
	  If EL_Channel.ErrorCode = 1 Or EL_Channel.ChannelType = 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelError", "频道参数错误"))
		 Call ApplicationTerminate()
	  End If
	  
	  If EL_Channel.ChannelModule <> 9 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelModuleError", "频道模块错误"))
		 Call ApplicationTerminate()
	  End If
	  
	  If EL_Channel.Disabled Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.Disabled", "该频道已被禁用"))
		 Call ApplicationTerminate()
	  End If
	  CurrentPage = EL_Common.ELRequest("page", 2) 
	  URLParameters = request.ServerVariables("QUERY_STRING")
	  If CurrentPage<1 Then
	     CurrentPage = 1
	  Else
	     URLParameters = EL_Common.ReplaceText(URLParameters, "\&{0,}page=[0-9]*", "")
		 If URLParameters <> "" And Left(URLParameters, 1) = "&" Then URLParameters = Right(URLParameters, Len(URLParameters)-1)
	  End If
	  
   End Sub
   
   Private Sub Class_Terminate
      Set CommonRegExp = Nothing
	  Set EL_Channel = Nothing
   End Sub
   
   Private Function ChannelCommonLabels(ByVal HTML)
      '频道通用标签
	  Dim TempHTML
	  
	  TempHTML = HTML
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelID}", ChannelID)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelName}", EL_Channel.ChannelName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelPictrue}", EL_Channel.ChannelPictrue)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelDir}", EL_Channel.ChannelDir)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ItemName}", EL_Channel.ItemName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ItemUnit}", EL_Channel.ItemUnit)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ClassItemName}", EL_Channel.ClassItemName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$UploadDir}", EL_Channel.UploadDir)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$MetaKeywords}", "<meta name=""keywords"" content="""& EL_Channel.MetaKeywords &""" />")
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$MetaDescription}", "<meta name=""description"" content="""& EL_Channel.MetaDescription &""" />")
	  TempHTML = Label_Online(TempHTML)
	  ChannelCommonLabels = TempHTML
   End Function
   
   Public Sub CreateIndex()
	  HTML = EL_Common.Template(ChannelID, 22, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", EL_Common.Join2String(EL_Channel.ChannelName, SiteTitle, EL_Common.TitleDivide))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  EL_Common.ShowPath = EL_Common.ShowPath & EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;&nbsp;") & EL_Channel.ChannelName
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  
	  HTML = ChannelCommonLabels(HTML)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$TodayNum}", GetForumInfo(1))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$TopicNum}", GetForumInfo(2))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$TotalNum}", GetForumInfo(3))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$UserNum}", GetForumInfo(4))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$NewUser}", GetForumInfo(5))
	  HTML = Label_ArrBoardList(HTML, 0)
	  
	  Response.Write HTML
   End Sub
   
   Public Sub ShowBoard()
      Dim EL_Board, PageTitle, StrPath
	  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  
	  
	  HTML = EL_Common.Template(ChannelID, 23, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  
	  PageTitle = EL_Common.Join2String(EL_Board.BoardName, EL_Board.ParentName, EL_Common.TitleDivide)
	  PageTitle = EL_Common.Join2String(PageTitle, EL_Channel.ChannelName, EL_Common.TitleDivide)
	  PageTitle = EL_Common.Join2String(PageTitle, SiteTitle, EL_Common.TitleDivide)	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", PageTitle)
	  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>"
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  HTML = ChannelCommonLabels(HTML)
	  
	  HTML = Label_BoardInfo(HTML, EL_Board)	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$BoardID}", EL_Board.BoardID)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$BoardName}", EL_Board.BoardName)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$Intro}", EL_Board.Intro)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ArrManager}", EL_Board.ArrManager)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PictrueURL}", EL_Board.PictrueURL)
	  HTML = Label_Topic(HTML, EL_Board)	  
	  
	  Set EL_Board = Nothing
	  Response.Write HTML
   End Sub
   
   Public Sub Search()
      If EL_User.UserIsLogin = False Then
		 Response.Redirect InstallDir &"User/User_Login.asp?url="& EL_Common.ServerURLEncode(ComeURL)
	  End If	  
	   
	  Dim PageTitle, SearchTitle, StrPath, SearchName
	  Dim IsSearch, ModuleType, SearchType, BoardID, ShowType, PostDateTime, Keyword
	  Dim SearchCmd, rsSearch, i, RowCount
	  Dim PageSizes, PageCounts, TotalRowCount
	  Dim FieldName
	  
	  If Instr(UCase(ComeURL), UCase(InstallDir & EL_Channel.ChannelDir &"/Search.asp")) < 1 Then
	     IsSearch = False
	  Else
	     IsSearch = True		 
	  End If
	  
	  ModuleType = EL_Common.ELRequest("ModuleType", 2)
	  SearchType = EL_Common.ELRequest("SearchType", 2)
	  BoardID = EL_Common.ELRequest("BoardID", 2)
	  ShowType = EL_Common.ELRequest("ShowType", 2)
	  PostDateTime = EL_Common.ELRequest("PostDateTime", 2)
	  Keyword = EL_Common.ELRequest("Keyword", 3)

	  If (ModuleType > 0 And ModuleType < 8) Or ModuleType = -1 Then 
	     IsSearch = True 
		 PostDateTime = 0
		 ShowType = 0
	  End If
	  
	  If ModuleType < 1 Or ModuleType > 7 Then
	     If Keyword = "" Then
		    EL_Common.ShowErrorMsg(EL_Common.Lang("Search.Error2", "搜索关键字不能为空"))
			Exit Sub
		 End If
	  End If
	  
	  '暂时屏蔽 我发表的主题 和 我参与的主题
	  If ModuleType = 1 Or ModuleType = 2 Then ModuleType = 3
	  
	  If IsSearch = True Then
	     If IsDate(Session("EL_LastSearchDateTime")) Then
	        If DateDiff("s", Session("EL_LastSearchDateTime"), Now()) < SearchInterval Then
		       EL_Common.ShowErrorMsg(EL_Common.RegExpStaticLabel(EL_Common.Lang("Search.Error1", "为节省系统资源,请在{$SearchInterval}秒后再执行搜索……"), "{$SearchInterval}", SearchInterval))
			   Exit Sub
		    End If
	     End If
	  End If
	  
	  Select Case ModuleType
	     Case 1: '我发表的主题
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type3", "")			
			Keyword = EL_User.UserName
	     Case 2: '我参与的主题
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type4", "")
			Keyword = EL_User.UserName
	     Case 3: '查看最新帖
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type5", "")
		 Case 4: '热门主题
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type6", "")
		 Case 5: '精华帖
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type7", "")
		 Case 6: '投票主题
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type8", "")
		 Case 7: '搜索用户帖子
		    SearchName = EL_Common.RegExpStaticLabel(EL_Common.Lang("Forum.Search.SearchType.Type9", ""), "{$UserName}", Keyword)
		 Case -1: '快速搜索 
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type0", "")
		 Case Else:
		    SearchName = EL_Common.Lang("Forum.Search.SearchType.Type"& SearchType, "")			
			SearchName = SearchName &":<span style='color:red'>"& EL_Common.ServerHTMLEncode(Keyword) &"</span>"
	  End Select
	  
	  If PostDateTime > 0 Then
	     PostDateTime = DateAdd("d", 0-PostDateTime, Now())
	  Else
	     PostDateTime = DateAdd("d", -999, Now())
	  End If
	  
	  If IsSearch = False Then SearchName = ""
	  SearchTitle = EL_Common.Lang("Forum.Search.Title", "论坛搜索")
	  
	  
	  HTML = EL_Common.Template(ChannelID, 5, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  
	  PageTitle = EL_Common.Join2String(SearchTitle, SiteTitle, EL_Common.TitleDivide)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", PageTitle)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  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>"& StrPath & SearchTitle
	  EL_Common.ShowPath = EL_Common.Join2String(EL_Common.ShowPath, SearchName, StrPath)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  HTML = ChannelCommonLabels(HTML)
	  
	  If IsSearch = False Then
	     HTML = EL_Common.RegExpStaticLabel(HTML, "{$SearchResult}", "")
		 HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPage}", "")
	  Else
	     Dim ReturnString, StrPage		 
		 Call EL_Common.InitCommand(SearchCmd, "EL_SP_SearchTopic")
	     With SearchCmd
	        .Parameters.Append .CreateParameter("RETURN", 2, 4)
		    .Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		    .Parameters.Append .CreateParameter("@BoardID", 3, 1, 4, BoardID)
			.Parameters.Append .CreateParameter("@ModuleType", 3, 1, 4, ModuleType)
			.Parameters.Append .CreateParameter("@SearchType", 3, 1, 4, SearchType)
			.Parameters.Append .CreateParameter("@ShowType", 3, 1, 4, ShowType)
			.Parameters.Append .CreateParameter("@PostDateTime", 200, 1, 30, PostDateTime)
		    .Parameters.Append .CreateParameter("@Keyword", 200, 1, 255, Keyword)
		    .Parameters.Append .CreateParameter("@CurrentPage", 3, 1, 4, CurrentPage)
		    .Parameters.Append .CreateParameter("@PageSizes", 3, 2, 4)
		    .Parameters.Append .CreateParameter("@TotalRowCount", 3, 2, 4)
		    .Parameters.Append .CreateParameter("@PageCount", 3, 2, 4)
		    .Parameters.Append .CreateParameter("@RowCount", 3, 2, 4)
		 Set rsSearch = .Execute()
	     End With
	     rsSearch.Close()  
	     PageSizes = SearchCmd(9)
	     TotalRowCount = SearchCmd(10)
	     PageCounts = SearchCmd(11)
	     RowCount = SearchCmd(12)
		 
		 If RowCount = 0 Then
		    ReturnString = EL_Common.RegExpStaticLabel(EL_Common.Lang("Search.NoList", "<p>&nbsp;</p>搜索不到任何{$ItemName}<p>&nbsp;</p>"), "{$ItemName}", EL_Channel.ItemName)
			StrPage = ""
		 Else
		    Dim Topic_Status, Topic_Title, Topic_Author, Topic_LastPost
			Dim Icon_Common, Icon_New, Icon_Hot, Icon_Elite, Icon_Vote, TopicLength
			Dim ParentID, TopicID, Title, TopicType, UserID, UserName, Color, Uploadfiles, IsElite, IsHot, Hits, Replys, LastPostUser, LastPostTime
			Dim PageNum, FileType, URL, ReplyPageSizes, ParentReplys
			
			Topic_Status = EL_Common.Lang("Forum.TopicMainTitle.Status", "")
			Topic_Title = EL_Common.Lang("Forum.TopicMainTitle.Title", "")
			Topic_Author = EL_Common.Lang("Forum.TopicMainTitle.Author", "")
			Topic_LastPost = EL_Common.Lang("Forum.TopicMainTitle.PostDateTime", "")	  
			Icon_Common = EL_Common.Lang("Forum.TopicStatus.Common", "")
			Icon_New = EL_Common.Lang("Forum.TopicStatus.New", "")

⌨️ 快捷键说明

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