-
Notifications
You must be signed in to change notification settings - Fork 34
/
feed.asp
448 lines (315 loc) · 16.5 KB
/
feed.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
<%@ CODEPAGE=65001 %>
<%
'///////////////////////////////////////////////////////////////////////////////
'// Z-Blog
'// 作 者: 朱煊(zx.asd)&(sipo)
'// 版权所有: RainbowSoft Studio
'// 技术支持: [email protected]
'// 程序名称:
'// 程序版本:
'// 单元名称: sydication.asp
'// 开始时间: 2006.07.30
'// 最后修改:
'// 备 注: 改名叫feed.asp
'///////////////////////////////////////////////////////////////////////////////
%>
<% Option Explicit %>
<% On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<% Response.Buffer=True %>
<!-- #include file="zb_users/c_option.asp" -->
<!-- #include file="zb_system/function/c_function.asp" -->
<!-- #include file="zb_system/function/c_system_lib.asp" -->
<!-- #include file="zb_system/function/c_system_base.asp" -->
<!-- #include file="zb_system/function/c_system_event.asp" -->
<!-- #include file="zb_system/function/c_system_plugin.asp" -->
<!-- #include file="zb_users/plugin/p_config.asp" -->
<%
Call System_Initialize()
'plugin node
For Each sAction_Plugin_Feed_Begin in Action_Plugin_Feed_Begin
If Not IsEmpty(sAction_Plugin_Feed_Begin) Then Call Execute(sAction_Plugin_Feed_Begin)
Next
Dim strAct
strAct="rss"
'如果不是"接收引用"就要检查非法链接
If (strAct<>"tb") And (strAct<>"search") Then Call CheckReference("")
'权限检查
If Not CheckRights(strAct) Then Call ShowError(6)
Response.ContentType = "text/xml"
'/////////////////////////////////////////////////////////////////////////////////
If Not IsEmpty(Request.QueryString("cate")) Then
Call ExportRSSbyCate(Request.QueryString("cate"))
ElseIf Not IsEmpty(Request.QueryString("tags")) Then
Call ExportRSSbyTags(Request.QueryString("tags"))
ElseIf Not IsEmpty(Request.QueryString("user")) Then
Call ExportRSSbyUser(Request.QueryString("user"))
ElseIf Not IsEmpty(Request.QueryString("date")) Then
Call ExportRSSbyDate(Request.QueryString("date"))
ElseIf Not IsEmpty(Request.QueryString("cmt")) Then
Call ExportRSSbyCmt(Request.QueryString("cmt"))
Else
Response.Write LoadFromFile(BlogPath & "zb_users\cache\rss.xml" ,"utf-8")
End If
'/////////////////////////////////////////////////////////////////////////////////
Function ExportRSSbyCate(CateID)
Dim Rss2Export
Dim objArticle
Set Rss2Export = New TNewRss2Export
With Rss2Export
Call CheckParameter(CateID,"int",0)
Dim objRS,CateName,CateIntro
.TimeZone=ZC_TIME_ZONE
'Call GetCategory()
Call GetUser
Dim Category
For Each Category In Categorys
If IsObject(Category) Then
If Category.ID=CateID Then
CateName=Category.Name
Exit For
End If
End If
Next
If IsEmpty(CateName) Then Exit Function
.AddChannelAttribute "title",TransferHTML(ZC_BLOG_TITLE & " - " & CateName,"[html-format]")
.AddChannelAttribute "link",TransferHTML(BlogHost,"[html-format]")
.AddChannelAttribute "description",TransferHTML(ZC_BLOG_SUBTITLE & " - " & CateIntro,"[html-format]")
.AddChannelAttribute "generator","RainbowSoft Studio Z-Blog " & ZC_BLOG_VERSION
.AddChannelAttribute "language",ZC_BLOG_LANGUAGE
.AddChannelAttribute "copyright",TransferHTML(ZC_BLOG_COPYRIGHT,"[nohtml][html-format]")
.AddChannelAttribute "pubDate",Now
Dim i
Set objRS=objConn.Execute("SELECT [log_ID],[log_Tag],[log_CateID],[log_Title],[log_Intro],[log_Content],[log_Level],[log_AuthorID],[log_PostTime],[log_CommNums],[log_ViewNums],[log_TrackBackNums],[log_Url],[log_Istop],[log_Template],[log_FullUrl],[log_Type],[log_Meta] FROM [blog_Article] WHERE ([log_ID]>0) AND ([log_Level]>2) AND ([log_CateID]="&CateID&") ORDER BY [log_PostTime] DESC")
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to ZC_RSS2_COUNT
Set objArticle=New TArticle
If objArticle.LoadInfoByArray(Array(objRS(0),objRS(1),objRS(2),objRS(3),objRS(4),objRS(5),objRS(6),objRS(7),objRS(8),objRS(9),objRS(10),objRS(11),objRS(12),objRS(13),objRS(14),objRS(15),objRS(16),objRS(17))) Then
If ZC_RSS_EXPORT_WHOLE Then
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlContent,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
Else
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlIntro,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
End If
End If
objRS.MoveNext
If objRS.eof Then Exit For
Set objArticle=Nothing
Next
End If
End With
objRS.close
Set objRS=Nothing
Rss2Export.Execute
Set Rss2Export = Nothing
End Function
Function ExportRSSbyUser(UserID)
Call GetUsersbyUserIDList(UserID)
Dim Rss2Export
Dim objArticle
Set Rss2Export = New TNewRss2Export
With Rss2Export
Call CheckParameter(UserID,"int",0)
Dim objRS,UserName,UserIntro
.TimeZone=ZC_TIME_ZONE
Dim User
For Each User In Users
If IsObject(User) Then
If User.ID=UserID Then
UserName=User.FirstName
Exit For
End If
End If
Next
If IsEmpty(UserName) Then Exit Function
.AddChannelAttribute "title",TransferHTML(ZC_BLOG_TITLE & " - " & UserName,"[html-format]")
.AddChannelAttribute "link",TransferHTML(BlogHost,"[html-format]")
.AddChannelAttribute "description",TransferHTML(ZC_BLOG_SUBTITLE & " - " & UserIntro,"[html-format]")
.AddChannelAttribute "generator","RainbowSoft Studio Z-Blog " & ZC_BLOG_VERSION
.AddChannelAttribute "language",ZC_BLOG_LANGUAGE
.AddChannelAttribute "copyright",TransferHTML(ZC_BLOG_COPYRIGHT,"[nohtml][html-format]")
.AddChannelAttribute "pubDate",Now
Dim i
Set objRS=objConn.Execute("SELECT [log_ID],[log_Tag],[log_CateID],[log_Title],[log_Intro],[log_Content],[log_Level],[log_AuthorID],[log_PostTime],[log_CommNums],[log_ViewNums],[log_TrackBackNums],[log_Url],[log_Istop],[log_Template],[log_FullUrl],[log_Type],[log_Meta] FROM [blog_Article] WHERE ([log_ID]>0) AND ([log_Level]>2) AND ([log_AuthorID]="&UserID&") ORDER BY [log_PostTime] DESC")
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to ZC_RSS2_COUNT
Set objArticle=New TArticle
If objArticle.LoadInfoByArray(Array(objRS(0),objRS(1),objRS(2),objRS(3),objRS(4),objRS(5),objRS(6),objRS(7),objRS(8),objRS(9),objRS(10),objRS(11),objRS(12),objRS(13),objRS(14),objRS(15),objRS(16),objRS(17))) Then
If ZC_RSS_EXPORT_WHOLE Then
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlContent,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
Else
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlIntro,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
End If
End If
objRS.MoveNext
If objRS.eof Then Exit For
Set objArticle=Nothing
Next
End If
End With
objRS.close
Set objRS=Nothing
Rss2Export.Execute
Set Rss2Export = Nothing
End Function
Function ExportRSSbyDate(YearMonth)
Dim Rss2Export
Dim objArticle
Set Rss2Export = New TNewRss2Export
With Rss2Export
Call CheckParameter(YearMonth,"dtm",Empty)
Dim objRS,UserName,UserIntro
.TimeZone=ZC_TIME_ZONE
.AddChannelAttribute "title",TransferHTML(ZC_BLOG_TITLE & " - " & UserName,"[html-format]")
.AddChannelAttribute "link",TransferHTML(BlogHost,"[html-format]")
.AddChannelAttribute "description",TransferHTML(ZC_BLOG_SUBTITLE & " - " & UserIntro,"[html-format]")
.AddChannelAttribute "generator","RainbowSoft Studio Z-Blog " & ZC_BLOG_VERSION
.AddChannelAttribute "language",ZC_BLOG_LANGUAGE
.AddChannelAttribute "copyright",TransferHTML(ZC_BLOG_COPYRIGHT,"[nohtml][html-format]")
.AddChannelAttribute "pubDate",Now
Dim i
Set objRS=objConn.Execute("SELECT [log_ID],[log_Tag],[log_CateID],[log_Title],[log_Intro],[log_Content],[log_Level],[log_AuthorID],[log_PostTime],[log_CommNums],[log_ViewNums],[log_TrackBackNums],[log_Url],[log_Istop],[log_Template],[log_FullUrl],[log_Type],[log_Meta] FROM [blog_Article] WHERE ([log_ID]>0) AND ([log_Level]>2) AND (Year([log_PostTime])="&Year(YearMonth)&") AND (Month([log_PostTime])="&Month(YearMonth)&") ORDER BY [log_PostTime] DESC")
If (Not objRS.bof) And (Not objRS.eof) Then
Do While Not objRS.eof
Set objArticle=New TArticle
If objArticle.LoadInfoByArray(Array(objRS(0),objRS(1),objRS(2),objRS(3),objRS(4),objRS(5),objRS(6),objRS(7),objRS(8),objRS(9),objRS(10),objRS(11),objRS(12),objRS(13),objRS(14),objRS(15),objRS(16),objRS(17))) Then
If ZC_RSS_EXPORT_WHOLE Then
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlContent,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
Else
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlIntro,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
End If
End If
objRS.MoveNext
If objRS.eof Then Exit Do
Set objArticle=Nothing
Loop
End If
End With
objRS.close
Set objRS=Nothing
Rss2Export.Execute
Set Rss2Export = Nothing
End Function
Function ExportRSSbyTags(TagsID)
Call GetTagsbyTagIDList("{"&TagsID&"}")
Dim Rss2Export
Dim objArticle
Set Rss2Export = New TNewRss2Export
With Rss2Export
Call CheckParameter(TagsID,"int",0)
Dim objRS,TagName
.TimeZone=ZC_TIME_ZONE
Dim Tag
For Each Tag In Tags
If IsObject(Tag) Then
If Tag.ID=TagsID Then
TagName=Tag.Name
Exit For
End If
End If
Next
If IsEmpty(TagName) Then Exit Function
.AddChannelAttribute "title",TransferHTML(ZC_BLOG_TITLE,"[html-format]") & " - " & TagName
.AddChannelAttribute "link",TransferHTML(BlogHost,"[html-format]")
.AddChannelAttribute "description",TransferHTML(ZC_BLOG_SUBTITLE,"[html-format]") & " - " & TagName
.AddChannelAttribute "generator","RainbowSoft Studio Z-Blog " & ZC_BLOG_VERSION
.AddChannelAttribute "language",ZC_BLOG_LANGUAGE
.AddChannelAttribute "copyright",TransferHTML(ZC_BLOG_COPYRIGHT,"[nohtml][html-format]")
.AddChannelAttribute "pubDate",Now
Dim i
Set objRS=objConn.Execute("SELECT [log_ID],[log_Tag],[log_CateID],[log_Title],[log_Intro],[log_Content],[log_Level],[log_AuthorID],[log_PostTime],[log_CommNums],[log_ViewNums],[log_TrackBackNums],[log_Url],[log_Istop],[log_Template],[log_FullUrl],[log_Type],[log_Meta] FROM [blog_Article] WHERE ([log_ID]>0) AND ([log_Level]>2) AND ([log_Tag] LIKE '%{"&TagsID&"}%') ORDER BY [log_PostTime] DESC")
If (Not objRS.bof) And (Not objRS.eof) Then
For i=1 to ZC_RSS2_COUNT
Set objArticle=New TArticle
If objArticle.LoadInfoByArray(Array(objRS(0),objRS(1),objRS(2),objRS(3),objRS(4),objRS(5),objRS(6),objRS(7),objRS(8),objRS(9),objRS(10),objRS(11),objRS(12),objRS(13),objRS(14),objRS(15),objRS(16),objRS(17))) Then
If ZC_RSS_EXPORT_WHOLE Then
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlContent,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
Else
.AddItem objArticle.HtmlTitle,Users(objArticle.AuthorID).Email & " (" & Users(objArticle.AuthorID).FirstName & ")",objArticle.HtmlUrl,objArticle.PostTime,objArticle.HtmlUrl,objArticle.HtmlIntro,Categorys(objArticle.CateID).HtmlName,objArticle.CommentUrl,objArticle.WfwComment,objArticle.WfwCommentRss,objArticle.TrackBackUrl
End If
End If
objRS.MoveNext
If objRS.eof Then Exit For
Set objArticle=Nothing
Next
End If
End With
objRS.close
Set objRS=Nothing
Rss2Export.Execute
Set Rss2Export = Nothing
End Function
Function ExportRSSbyCmt(intID)
Dim Rss2Export
Dim objArticle
Dim objRS
Dim objComment
Set Rss2Export = New TNewRss2Export
With Rss2Export
Call CheckParameter(intID,"int",0)
Set objArticle=New TArticle
If intID = 0 Then
.TimeZone=ZC_TIME_ZONE
.AddChannelAttribute "title",TransferHTML(ZC_BLOG_TITLE & "-" & ZC_MSG027,"[html-format]")
.AddChannelAttribute "link",TransferHTML(BlogHost,"[html-format]")
.AddChannelAttribute "generator","RainbowSoft Studio Z-Blog " & ZC_BLOG_VERSION
.AddChannelAttribute "language",ZC_BLOG_LANGUAGE
.AddChannelAttribute "pubDate",Now
Set objRS=objConn.Execute("SELECT TOP " & ZC_RSS2_COUNT & " * FROM [blog_Comment] WHERE ([comm_ID]>0) AND ([log_ID]>0) AND ([comm_isCheck]=0) ORDER BY [comm_PostTime] DESC")
Call GetUser
Dim User
Do While Not objRS.eof
Set objComment=New TComment
If objComment.LoadInfoByArray(Array(objRS("comm_ID"),objRS("log_ID"),objRS("comm_AuthorID"),objRS("comm_Author"),objRS("comm_Content"),objRS("comm_Email"),objRS("comm_HomePage"),objRS("comm_PostTime"),objRS("comm_IP"),objRS("comm_Agent"),objRS("comm_Reply"),objRS("comm_LastReplyIP"),objRS("comm_LastReplyTime"),objRS("comm_ParentID"),objRS("comm_IsCheck"),objRs("comm_Meta"))) And objArticle.LoadInfoByID(objRS("log_ID")) Then
If objComment.AuthorID>0 Then
For Each User in Users
If IsObject(User) Then
If User.ID=objComment.AuthorID Then
objComment.Author = User.FirstName
Exit For
End If
End If
Next
End If
.AddItem "Re:"&objArticle.HtmlTitle,objComment.Email & " (" & objComment.Author & ")",objArticle.HtmlUrl & "#cmt" & objComment.ID,objComment.PostTime,objArticle.HtmlUrl & "#cmt" & objComment.ID,objComment.HtmlContent,"","","","",""
End If
Set objComment=Nothing
objRS.MoveNext
Loop
objRS.close
Set objRS=Nothing
ElseIf objArticle.LoadInfoByID(intID) Then
.TimeZone=ZC_TIME_ZONE
.AddChannelAttribute "title",TransferHTML(ZC_BLOG_TITLE,"[html-format]")& "-" & objArticle.HtmlTitle
.AddChannelAttribute "link",objArticle.HtmlUrl
.AddChannelAttribute "generator","RainbowSoft Studio Z-Blog " & ZC_BLOG_VERSION
.AddChannelAttribute "language",ZC_BLOG_LANGUAGE
.AddChannelAttribute "pubDate",objArticle.PostTime
If objArticle.CommNums>0 Then
Set objRS=objConn.Execute("SELECT * FROM [blog_Comment] WHERE ([comm_ID]>0) AND ([log_ID]="&intID&") AND ([comm_isCheck]=0) ORDER BY [comm_PostTime] DESC")
Do While Not objRS.eof
Set objComment=New TComment
If objComment.LoadInfoByArray(Array(objRS("comm_ID"),objRS("log_ID"),objRS("comm_AuthorID"),objRS("comm_Author"),objRS("comm_Content"),objRS("comm_Email"),objRS("comm_HomePage"),objRS("comm_PostTime"),objRS("comm_IP"),objRS("comm_Agent"),objRS("comm_Reply"),objRS("comm_LastReplyIP"),objRS("comm_LastReplyTime"),objRS("comm_ParentID"),objRS("comm_IsCheck"),objRs("comm_Meta"))) Then
.AddItem "Re:"&objArticle.HtmlTitle,objComment.Author,objArticle.HtmlUrl & "#cmt" & objComment.ID,objComment.PostTime,objArticle.HtmlUrl & "#cmt" & objComment.ID,objComment.HtmlContent,"","","","",""
End If
Set objComment=Nothing
objRS.MoveNext
Loop
objRS.close
Set objRS=Nothing
End If
End If
Set objArticle=Nothing
End With
Rss2Export.Execute
Set Rss2Export = Nothing
End Function
'/////////////////////////////////////////////////////////////////////////////////
'plugin node
For Each sAction_Plugin_Feed_End in Action_Plugin_Feed_End
If Not IsEmpty(sAction_Plugin_Feed_End) Then Call Execute(sAction_Plugin_Feed_End)
Next
Call System_Terminate()
If Err.Number<>0 then
Call ShowError(0)
End If
%>