%@ CODEPAGE=65001 %>
<%
'///////////////////////////////////////////////////////////////////////////////
'// Z-Blog
'// 作 者: 朱煊(zx.asd)
'// 版权所有: RainbowSoft Studio
'// 技术支持: rainbowsoft@163.com
'// 程序名称:
'// 程序版本:
'// 单元名称:
'// 开始时间:
'// 最后修改:
'// 备 注:
'///////////////////////////////////////////////////////////////////////////////
%>
<% Option Explicit %>
<% 'On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<% Response.Buffer=True %>
<%
'-----------------------------------------------------------------------------------------
Const PageTitle="我们的相册"
Call System_Initialize()
'plugin node
For Each sAction_Plugin_Tags_Begin in Action_Plugin_Tags_Begin
If Not IsEmpty(sAction_Plugin_Tags_Begin) Then Call Execute(sAction_Plugin_Tags_Begin)
Next
LoadGlobeCache
Dim strPage,strAlbum
strPage=Request.QueryString("page")
strAlbum=Request.QueryString("album")
BuildCacheFolder("content")
Dim strPageTitle
strPageTitle=TransferHTML(PageTitle,"[html-japan][html-format]")
If Request.QueryString("title")<>"" Then strPageTitle=strPageTitle & " - " & Request.QueryString("title")
Dim strImages
If strAlbum="" Then
Call CheckParameter(strPage,"int",1)
strImages=LoadFromFile(Server.MapPath("content/Page_"& strPage &".html"),"utf-8")
If strImages=Empty Then
strImages=ExportAlbumPage(strPage)
Call SaveToFile(Server.MapPath("content/Page_"& strPage &".html"),strImages,"utf-8",False)
End If
Else
Call CheckParameter(strAlbum,"int",-1)
If strAlbum<>-1 Then
Call CheckParameter(strPage,"int",1)
strImages=LoadFromFile(Server.MapPath("content/Album_"& strAlbum &"_Page_"& strPage &".html"),"utf-8")
If strImages=Empty Then
strImages=ExportImagePage(strAlbum,strPage)
Call SaveToFile(Server.MapPath("content/Album_"& strAlbum &"_Page_"& strPage &".html"),strImages,"utf-8",False)
End If
End If
End If
Dim strContent
strContent=BuildContentCache
strContent=Replace(strContent,"%ZC_BLOG_HOST%",ZC_BLOG_HOST)
strContent=TransferHTML(UBBCode(strContent,"[face][link][autolink][font][code][image][typeset][media][flash][key]"),"[html-japan][vbCrlf][upload]")
strContent=strImages & "
" & strContent &"
"
strContent=strContent & ""
Dim ArtList
Set ArtList=New TArticleList
ArtList.LoadCache
ArtList.template="ATTACHGALLERY"
ArtList.Title=strPageTitle
ArtList.Build
ArtList.SetVar "CUSTOM_TAGS",strContent
ArtList.SetVar "CUSTOM_TAGS_TITLE",strPageTitle
ArtList.SetVar "CUSTOM_TAGS_BODYCLASS","gallery"
Response.Write ArtList.html
'plugin node
For Each sAction_Plugin_Tags_End in Action_Plugin_Tags_End
If Not IsEmpty(sAction_Plugin_Tags_End) Then Call Execute(sAction_Plugin_Tags_End)
Next
'*********************************************************
' 目的: 显示所有相册
'*********************************************************
Function ExportAlbumPage(intPage)
On Error Resume Next
Dim i
Dim objRS
Dim strSQL
Dim strPage
Dim strPageBar
Dim intPageAll
Dim ImageUrl
Dim ImageInfo
Dim ImageTitle
Dim ImageItem
Dim objRSsub
Dim ContentNum
Dim AllImageNum
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.CursorType = adOpenKeyset
objRS.LockType = adLockReadOnly
objRS.ActiveConnection=objConn
objRS.Source=""
strSQL="WHERE [ul_DownNum]=(-1) "
objRS.Open("SELECT * FROM [blog_UpLoad] " & strSQL & " ORDER BY [ul_PostTime] DESC")
objRS.PageSize=AttachGallery_PageCount
If objRS.PageCount>0 Then objRS.AbsolutePage = intPage
intPageAll=objRS.PageCount
Set objRSsub=objConn.Execute("SELECT COUNT([ul_ID]) FROM [blog_UpLoad] WHERE [ul_DownNum]>0")
AllImageNum = objRSsub(0)+objRS.RecordCount
Set objRSsub=Nothing
ExportAlbumPage = ExportAlbumPage & "所有相册 (共 "& objRS.RecordCount &" 个相册, "& AllImageNum &" 个图片.)
"
ExportAlbumPage = ExportAlbumPage & ""
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to objRS.PageSize
Set objRSsub=objConn.Execute("SELECT COUNT([ul_ID]) FROM [blog_UpLoad] WHERE [ul_DownNum]=" & objRS("ul_ID") )
ContentNum = objRSsub(0)
ContentNum = ContentNum + 1
Set objRSsub=Nothing
ExportAlbumPage = ExportAlbumPage & "
"
ImageItem = "
![]()
"
If IsNull(objRS("ul_Quote"))=False And objRS("ul_Quote")<>"" Then
If CBool(objRS("ul_Quote"))=True Then
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&Year(objRS("ul_PostTime")) & "/" & Month(objRS("ul_PostTime")) & "/"&objRS("ul_FileName")
Else
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&objRS("ul_FileName")
End If
Else
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&objRS("ul_FileName")
End If
If AttachGallery_BuildMiniImage=False Then ImageItem=Replace(ImageItem,"{%ImageMini%}","{%ImageUrl%}")
ImageItem=Replace(ImageItem,"{%ImageUrl%}",ImageUrl)
ImageItem=Replace(ImageItem,"{%ImageMini%}",ImageUrl & ".mini.jpeg")
ImageInfo = LoadFromFile(BlogPath & ImageUrl &".album","utf-8")
ImageTitle=TransferHTML(ImageInfo,"[nohtml]")
If InStr(ImageTitle,vbCrlf)>0 Then ImageTitle=Left(ImageTitle,InStr(ImageTitle,vbCrlf)-1)
If ImageTitle="" Then ImageTitle="Unnamed Album"
ImageItem=Replace(ImageItem,"{%ImageTitle%}",ImageTitle)
ExportAlbumPage = ExportAlbumPage & ImageItem
If Len(ImageTitle)>11 Then ImageTitle=Left(ImageTitle,9) & "..."
ExportAlbumPage = ExportAlbumPage & "
"&ImageTitle&" ("&ContentNum&")
"
ExportAlbumPage = ExportAlbumPage & "
"
objRS.MoveNext
If objRS.eof Then Exit For
Next
End If
ExportAlbumPage = ExportAlbumPage & "
"
ExportAlbumPage = ExportAlbumPage & ""
If intPageAll>1 Then
Dim s
Dim a,b
strPage=""
strPageBar=""
s=ZC_BLOG_HOST & AttachGallery_PagePath &"/?page=1"
Application.Lock
strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR")
Application.UnLock
strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",ZC_MSG285)
strPage=strPage & strPageBar
If intPageAll>ZC_PAGEBAR_COUNT Then
a=intPage
b=intPage+ZC_PAGEBAR_COUNT
If a>ZC_PAGEBAR_COUNT Then a=a-1:b=b-1
If b>intPageAll Then b=intPageAll:a=intPageAll-ZC_PAGEBAR_COUNT
Else
a=1:b=intPageAll
End If
For i=a to b
s=ZC_BLOG_HOST & AttachGallery_PagePath &"/?page="& i
Application.Lock
strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR")
Application.UnLock
If i=intPage then
strPage=strPage & "
" & i & ""
Else
strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",i)
strPage=strPage & strPageBar
End If
Next
s=ZC_BLOG_HOST & AttachGallery_PagePath &"/?page="& intPageAll
Application.Lock
strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR")
Application.UnLock
strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",ZC_MSG286)
strPage=strPage & strPageBar
End If
ExportAlbumPage = ExportAlbumPage & "
" & strPage & "
"
ExportAlbumPage = ExportAlbumPage & "
"
objRS.Close
Set objRS=Nothing
Err.Clear
End Function
'*********************************************************
' 目的: 显示所有附件中的图片
'*********************************************************
Function ExportImagePage(intAlbum,intPage)
On Error Resume Next
Dim i
Dim objRS
Dim strSQL
Dim strPage
Dim strPageBar
Dim intPageAll
Dim ImageUrl
Dim ImageInfo
Dim ImageTitle
Dim ImageItem
Dim AlbumTitle
Dim AlbumInfo
Dim objArticle
Dim Reference
'输出相册说明信息
Set objRS=objConn.Execute("SELECT * FROM [blog_UpLoad] WHERE [ul_ID]="& intAlbum &"")
If (Not objRS.bof) And (Not objRS.eof) Then
If IsNull(objRS("ul_Quote"))=False And objRS("ul_Quote")<>"" Then
If CBool(objRS("ul_Quote"))=True Then
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&Year(objRS("ul_PostTime")) & "/" & Month(objRS("ul_PostTime")) & "/"&objRS("ul_FileName")
ImageInfo = LoadFromFile(BlogPath & ImageUrl &".album","utf-8")
Else
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&objRS("ul_FileName")
ImageInfo = LoadFromFile(BlogPath & ImageUrl &".album","utf-8")
End If
Else
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&objRS("ul_FileName")
ImageInfo = LoadFromFile(BlogPath & ImageUrl &".album","utf-8")
End If
ImageTitle=TransferHTML(ImageInfo,"[nohtml]")
If InStr(ImageTitle,vbCrlf)>0 Then ImageTitle=Left(ImageTitle,InStr(ImageTitle,vbCrlf)-1)
AlbumTitle=ImageTitle
If AlbumTitle="" Then AlbumTitle="Unnamed Album"
ImageInfo=TransferHTML(ImageInfo,"[nohtml]")
If InStr(ImageInfo,vbCrlf)>0 Then
ImageInfo=Right(ImageInfo,Len(ImageInfo)-InStr(ImageInfo,vbCrlf))
Else
ImageInfo=""
End If
ImageInfo=TransferHTML(ImageInfo,"[enter]")
AlbumInfo=ImageInfo
If AlbumInfo="" Then AlbumInfo="No Description"
End If
objRS.Close
Set objRS=Nothing
'输出相册相关文章
Reference=""
Reference=LoadFromFile(BlogPath & ImageUrl &".refer","utf-8")
If Reference="" Then Reference="无相关文章"
If Not AttachGallery_UseReference Then Reference="相关文章功能已禁用!"
'输出相册中的图片
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.CursorType = adOpenKeyset
objRS.LockType = adLockReadOnly
objRS.ActiveConnection=objConn
objRS.Source=""
strSQL="WHERE ([ul_DownNum]="& intAlbum &" OR [ul_ID]="& intAlbum &") "
objRS.Open("SELECT * FROM [blog_UpLoad] " & strSQL & " ORDER BY [ul_PostTime] ASC")
objRS.PageSize=AttachGallery_PageCount
If objRS.PageCount>0 Then objRS.AbsolutePage = intPage
intPageAll=objRS.PageCount
ExportImagePage = ExportImagePage & ""
ExportImagePage = ExportImagePage & ""
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to objRS.PageSize
ExportImagePage = ExportImagePage & "
"
If CheckPluginState("LightBox")=False Then
ImageItem = "
![]()
{%ImageInfo%}
"
Else
ImageItem = "
![]()
"
End If
If IsNull(objRS("ul_Quote"))=False And objRS("ul_Quote")<>"" Then
If CBool(objRS("ul_Quote"))=True Then
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&Year(objRS("ul_PostTime")) & "/" & Month(objRS("ul_PostTime")) & "/"&objRS("ul_FileName")
Else
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&objRS("ul_FileName")
End If
Else
ImageUrl = ZC_UPLOAD_DIRECTORY &"/"&objRS("ul_FileName")
End If
If AttachGallery_BuildMiniImage=False Then ImageItem=Replace(ImageItem,"{%ImageMini%}","{%ImageUrl%}")
ImageItem=Replace(ImageItem,"{%ImageUrl%}",ImageUrl)
ImageItem=Replace(ImageItem,"{%ImageMini%}",ImageUrl & ".mini.jpeg")
ImageInfo = LoadFromFile(BlogPath & ImageUrl &".info","utf-8")
ImageTitle=TransferHTML(ImageInfo,"[nohtml]")
If InStr(ImageTitle,vbCrlf)>0 Then ImageTitle=Left(ImageTitle,InStr(ImageTitle,vbCrlf)-1)
If ImageTitle="" Then ImageTitle="Unnamed Image"
ImageInfo=TransferHTML(ImageInfo,"[nohtml]")
ImageInfo=TransferHTML(ImageInfo,"[enter]")
If ImageInfo="" Then ImageInfo="No Infomation"
ImageItem=Replace(ImageItem,"{%ImageTitle%}",ImageTitle)
ImageItem=Replace(ImageItem,"{%ImageInfo%}","
[" & FormatDateTime(objRS("ul_PostTime"),vbLongDate) & "]" & ImageInfo)
ExportImagePage = ExportImagePage & ImageItem
If Len(ImageTitle)>13 Then ImageTitle=Left(ImageTitle,10) & "..."
ExportImagePage = ExportImagePage & "
"&ImageTitle&"
"
ExportImagePage = ExportImagePage & "
"
objRS.MoveNext
If objRS.eof Then Exit For
Next
End If
ExportImagePage = ExportImagePage & "
"
ExportImagePage = ExportImagePage & ""
If intPageAll>1 Then
Dim s
Dim a,b
strPage=""
strPageBar=""
s=ZC_BLOG_HOST & AttachGallery_PagePath &"/?album="& intAlbum &"&page=1"
Application.Lock
strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR")
Application.UnLock
strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",ZC_MSG285)
strPage=strPage & strPageBar
If intPageAll>ZC_PAGEBAR_COUNT Then
a=intPage
b=intPage+ZC_PAGEBAR_COUNT
If a>ZC_PAGEBAR_COUNT Then a=a-1:b=b-1
If b>intPageAll Then b=intPageAll:a=intPageAll-ZC_PAGEBAR_COUNT
Else
a=1:b=intPageAll
End If
For i=a to b
s=ZC_BLOG_HOST & AttachGallery_PagePath &"/?album="& intAlbum &"&page="& i
Application.Lock
strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR")
Application.UnLock
If i=intPage then
strPage=strPage & "
" & i & ""
Else
strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",i)
strPage=strPage & strPageBar
End If
Next
s=ZC_BLOG_HOST & AttachGallery_PagePath &"/?album="& intAlbum &"&page="& intPageAll
Application.Lock
strPageBar=Application(ZC_BLOG_CLSID & "TEMPLATE_B_PAGEBAR")
Application.UnLock
strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",ZC_MSG286)
strPage=strPage & strPageBar
End If
ExportImagePage = ExportImagePage & "
" & strPage & "
"
ExportImagePage = ExportImagePage & "
"
objRS.Close
Set objRS=Nothing
ExportImagePage = ExportImagePage & ""
ExportImagePage = ExportImagePage & "相册说明:
"& AlbumTitle &"
" & AlbumInfo &"
"
Err.Clear
End Function
'*********************************************************
' 目的: 把编辑的内容转化为服务器变量
'*********************************************************
Function BuildContentCache()
Dim TmpContent
Application.Lock
TmpContent=Application(ZC_BLOG_CLSID & "IMGSHW_CONTENT")
Application.UnLock
If TmpContent=Empty Then
TmpContent=LoadFromFile(Server.MapPath("content.html"),"utf-8")
Application.Lock
Application(ZC_BLOG_CLSID & "IMGSHW_CONTENT")=TmpContent
Application.UnLock
End If
BuildContentCache=TmpContent
End Function
'*********************************************************
' 目的: 建立缓存目录
'*********************************************************
Function BuildCacheFolder(strFolderName)
On Error Resume Next
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists(Server.MapPath(strFolderName))=False) Then
Call fso.CreateFolder(Server.MapPath(strFolderName))
End If
Set fso = Nothing
Err.Clear
End Function
'*********************************************************
%><%
Call System_Terminate()
If Err.Number<>0 then
Call ShowError(0)
End If
%>