📄 classphoto.asp
字号:
<%
Class ClassPhoto
Private HTML, CommonRegExp, EL_Channel, ClassID, ShowClassType
Private EL_Flag, CurrentPage, URLParameters, ReplaceKeyType
Private Sub Class_Initialize
Set CommonRegExp = New RegExp
CommonRegExp.IgnoreCase = True
CommonRegExp.Global = True
EL_Flag = True
ReplaceKeyType = 0 '内容页字符替换模式 0:站内链接 1:字符过滤 2:两者
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 <> 6 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)
ShowClassType = EL_Common.ELRequest("ShowType", 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 = EL_Common.RegExpStaticLabel(TempHTML, "{$ShowClassMenu}", "<script language='JavaScript1.2' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowClassMenu.js'></script>")
TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ShowSearchForm}", "<script language='JavaScript' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowSearchForm.js'></script>")
ChannelCommonLabels = TempHTML
End Function
Public Sub CreateIndex()
ClassID = 0
HTML = EL_Common.Template(ChannelID, 1, 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", " >> ") & EL_Channel.ChannelName
HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
HTML = ChannelCommonLabels(HTML)
HTML = Label_ArrClassList(HTML)
HTML = Label_GetPhotoList(HTML)
Session("EL_LastSearchDateTime") = Now()
Response.Write HTML
End Sub
Public Sub Search()
Dim SearchCmd, rsSearch, RowCount, i, SearchResultTitle
Dim PageTitle, SearchTitle, StrPath, PageSizes, PageCounts, TotalRowCount
Dim FieldName, Keyword
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
FieldName = EL_Common.ELRequest("Field", 3)
ClassID = EL_Common.ELRequest("ClassID", 2)
Keyword = EL_Common.ELRequest("Keyword", 3)
Select Case LCase(FieldName)
Case "photoname": SearchResultTitle = EL_Common.Lang("Search.f0", "标题中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
Case "content": SearchResultTitle = EL_Common.Lang("Search.f1", "内容中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
Case "author": SearchResultTitle = EL_Common.Lang("Search.f2", "作者姓名中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
Case Else:
FieldName = "PhotoName" : SearchResultTitle = EL_Common.Lang("Search.f0", "标题中含有 <font color='red'>{$Keyword}</font> 的{$ItemName}")
End Select
If Trim(Keyword) = "" Then
EL_Common.ShowErrorMsg(EL_Common.Lang("Search.Error2", "搜索关键字不能为空"))
Exit Sub
End If
Call EL_Common.InitCommand(SearchCmd, "EL_SP_SearchPhoto")
With SearchCmd
.Parameters.Append .CreateParameter("RETURN", 2, 4)
.Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
.Parameters.Append .CreateParameter("@Field", 200, 1, 100, FieldName)
.Parameters.Append .CreateParameter("@ClassID", 3, 1, 4, ClassID)
.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(6)
TotalRowCount = SearchCmd(7)
PageCounts = SearchCmd(8)
RowCount = SearchCmd(9)
HTML = EL_Common.Template(ChannelID, 5, 0)
HTML = EL_Common.ReplaceCommonLabels(HTML)
SearchTitle = EL_Common.RegExpStaticLabel(EL_Common.Lang("Search.Title", "{$ItemName}搜索"), "{$ItemName}", EL_Channel.ItemName)
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", " >>")
EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/Index.asp'>"& EL_Channel.ChannelName &"</a>"& StrPath & SearchTitle
HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
HTML = ChannelCommonLabels(HTML)
SearchResultTitle = EL_Common.RegExpStaticLabel(SearchResultTitle, "{$ItemName}", EL_Channel.ItemName)
SearchResultTitle = EL_Common.RegExpStaticLabel(SearchResultTitle, "{$Keyword}", EL_Common.ServerHTMLEncode(Keyword))
HTML = EL_Common.RegExpStaticLabel(HTML, "{$SearchResultTitle}", SearchResultTitle)
HTML = EL_Common.RegExpStaticLabel(HTML, "{$Keyword}", EL_Common.ServerHTMLEncode(Keyword))
Dim Match, Matches, ReturnString
Dim TempString, MatchString, NoList
CommonRegExp.Pattern = "\[ArrSearchResult\][\w\W]*\[\/ArrSearchResult\]"
Set Matches = CommonRegExp.Execute(HTML)
NoList = EL_Common.RegExpStaticLabel(EL_Common.Lang("Search.NoList", "<p> </p>搜索不到任何{$ItemName}<p> </p>"), "{$ItemName}", EL_Channel.ItemName)
If RowCount = 0 Then
For Each Match in Matches
HTML = Replace(HTML, Match.Value, NoList)
Next
HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPage}", "")
Else
rsSearch.Open()
For Each Match in Matches
rsSearch.MoveFirst
MatchString = Match.Value
MatchString = EL_Common.ReplaceText(MatchString, "\[ArrSearchResult\]", "")
MatchString = EL_Common.ReplaceText(MatchString, "\[\/ArrSearchResult\]", "")
ReturnString = ""
Dim ItemHTML, Field_Title, Field_Content, Field_Author
For i = 1 To RowCount
Field_Title = EL_Common.HTMLEncode(rsSearch("PhotoName"))
Field_Content = EL_Common.GetTopic(EL_Common.RemoveHTML(rsSearch("Content")), 380)
Field_Author = rsSearch("Author")
Select Case LCase(FieldName)
Case "title": Field_Title = Replace(Field_Title, Keyword, "<font color=red>"& Keyword &"</font>")
Case "content": Field_Content = Replace(Field_Content, Keyword, "<font color=red>"& Keyword &"</font>")
Case "author": Field_Author = Replace(Field_Author, Keyword, "<font color=red>"& Keyword &"</font>")
Case Else: Field_Title = Replace(Field_Title, Keyword, "<font color=red>"& Keyword &"</font>")
End Select
ItemHTML = MatchString
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_Index}", (CurrentPage-1)*PageSizes + i)
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_PhotoID}", rsSearch("PhotoID"))
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_ClassName}", "<a href='"& InstallDir & EL_Channel.ChannelDir &"/ShowClass.asp?ClassID="& rsSearch("ClassID") &"'>"& rsSearch("ClassName") &"</a>")
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_PhotoName}", "<a href='"& InstallDir & EL_Channel.ChannelDir &"/ShowPhoto.asp?PhotoID="& rsSearch("PhotoID") &"' target='_blank'>"& Field_Title &"</a>")
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_Author}", Field_Author)
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_UpdateTime}", rsSearch("UpdateTime"))
If Trim(rsSearch("DefaultPictrue")) = "" Then
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_DefaultPictrue}", "")
Else
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_DefaultPictrue}", "<a href='"& InstallDir & EL_Channel.ChannelDir &"/ShowPhoto.asp?PhotoID="& rsSearch("PhotoID") &"' target='_blank'><img src='"& EL_Common.PictrueURL(rsSearch("DefaultPictrue"), EL_Channel.FilePath) &"' width=120 height=80 border=0></a>")
End If
ItemHTML = EL_Common.RegExpStaticLabel(ItemHTML, "{$Arr_Content}", Field_Content)
ReturnString = ReturnString & ItemHTML
If i<RowCount Then rsSearch.MoveNext
Next
HTML = Replace(HTML, Match.Value, ReturnString)
Next
rsSearch.Close()
Dim PageHTML
PageHTML = EL_Common.Lang("BaseConfig.ShowPage", "")
PageHTML = EL_Common.ReplaceText(PageHTML, "\{\$PageList\}", EL_Common.ShowPage(URLParameters, CurrentPage, PageSizes, PageCounts, TotalRowCount, EL_Channel.ItemName, EL_Channel.ItemUnit))
HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPage}", PageHTML)
End If
HTML = Label_GetPhotoList(HTML)
Set Matches = Nothing
Set rsSearch = Nothing
Set SearchCmd = Nothing
Response.Write HTML
End Sub
Public Sub ShowCommend()
Dim StrCommend, ColNum
ClassID = 0
StrCommend = EL_Common.Lang("BaseConfig.Commend", "推荐{$ItemName}")
StrCommend = EL_Common.RegExpStaticLabel(StrCommend, "{$ItemName}", EL_Channel.ItemName)
HTML = EL_Common.Template(ChannelID, 4, 0)
HTML = EL_Common.ReplaceCommonLabels(HTML)
HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", EL_Common.Join2String(EL_Common.Join2String(StrCommend, EL_Channel.ChannelName, EL_Common.TitleDivide), 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", " >> ") &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/'>"& EL_Channel.ChannelName &"</a>"& EL_Common.Lang("BaseConfig.Path", " >> ") & StrCommend
HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
HTML = ChannelCommonLabels(HTML)
ColNum = EL_Common.Lang("Photo.CommendColNum", 4)
HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowCommendList}", PhotoList(ChannelID, 0, 10, 120, 80, 18, True, 4, 0, ColNum, True))
HTML = Label_GetPhotoList(HTML)
Response.Write HTML
End Sub
Public Sub ShowPhoto()
Dim PhotoCmd, rsPhoto, i, StrPath
Dim PhotoID, PhotoName, Keywords, Author, Copyfrom, Content, Uploadfiles, Hits, UpdateTime, Inputer, Editor, SkinID, TemplateID
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -