PageRenderTime 43ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/Wap/Space/List.asp

https://github.com/joechen2010/health
ASP | 266 lines | 256 code | 10 blank | 0 comment | 0 complexity | f4c7ba2f020f429c90622c1979f7f539 MD5 | raw file
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <%Response.ContentType = "text/vnd.wap.wml; charset=utf-8"%><?xml version="1.0" encoding="utf-8"?>
  3. <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
  4. <!--#include file="../Conn.asp"-->
  5. <!--#include file="../KS_Cls/Kesion.CommonCls.asp"-->
  6. <!--#include file="../KS_Cls/Kesion.Label.CommonCls.asp"-->
  7. <!--#include file="../KS_Cls/Kesion.SpaceCls.asp"-->
  8. <%
  9. Dim KSCls
  10. Set KSCls = New List
  11. KSCls.Kesion()
  12. Set KSCls = Nothing
  13. Class List
  14. Private KS,KSBCls,KSRFObj
  15. Private RS,ID
  16. Private UserName,UserType,Template,BlogName
  17. Private MaxPerPage,CurrentPage
  18. Private Sub Class_Initialize()
  19. Set KS=New PublicCls
  20. Set KSBCls=New BlogCls
  21. Set KSRFObj=New Refresh
  22. End Sub
  23. Private Sub Class_Terminate()
  24. Set KS=Nothing
  25. Set KSBCls=Nothing
  26. Set KSRFObj=Nothing
  27. End Sub
  28. Public Sub Kesion()
  29. If KS.SSetting(0)=0 Then
  30. Call KS.ShowError("对不起!","对不起,本站点关闭空间站点功能!")
  31. End If
  32. ID=KS.ChkClng(KS.S("ID"))
  33. UserName=KS.S("UserName")
  34. If UserName="" Then Response.End()
  35. Dim RS:Set RS=Server.CreateObject("ADODB.RECORDSET")
  36. RS.Open "Select * From KS_Blog Where UserName='" & UserName & "'",Conn,1,1
  37. If RS.Eof And RS.Bof Then
  38. RS.Close:Set RS=Nothing
  39. Call KS.ShowError("该用户没有开通空间站点!","该用户没有开通空间站点!")
  40. End If
  41. If RS("Status")=0 Then
  42. RS.Close:Set RS=Nothing
  43. Call KS.ShowError("该空间站点尚未审核!","该空间站点尚未审核!")
  44. ElseIf RS("Status")=2 Then
  45. RS.Close:Set RS=Nothing
  46. Call KS.ShowError("该空间站点已被管理员锁定!","该空间站点已被管理员锁定!")
  47. End If
  48. BlogName=RS("BlogName")
  49. UserType=KS.ChkClng(Conn.Execute("Select UserType From KS_User Where UserName='" & UserName & "'")(0))
  50. Dim MainTemplate,TemplateSub
  51. If UserType=1 Then
  52. MainTemplate=KSRFObj.LoadTemplate(KS.WSetting(23))'企业主模板
  53. TemplateSub=KSRFObj.LoadTemplate(KS.WSetting(27))'企业日志副模板
  54. Else
  55. MainTemplate=KSRFObj.LoadTemplate(KS.WSetting(20))'个人主模板
  56. TemplateSub=KSRFObj.LoadTemplate(KS.WSetting(28))'个人日志副模板
  57. End If
  58. MainTemplate=KSRFObj.KSLabelReplaceAll(MainTemplate)
  59. MainTemplate=KSBCls.ReplaceBlogLabel(RS,MainTemplate)
  60. MainTemplate=KSBCls.ReplaceAllLabel(UserName,MainTemplate)
  61. RS.Close
  62. If KSUser.GroupID<>4 Then
  63. RS.Open "Select * from KS_BlogInfo Where ID=" & ID & " And Status=0",Conn,1,3
  64. Else
  65. RS.Open "Select * from KS_BlogInfo Where ID=" & ID,Conn,1,3
  66. End If
  67. If RS.EOF And RS.BOF Then
  68. Call KS.ShowError("参数传递出错或该日志为草稿!","参数传递出错或该日志为草稿!")
  69. End If
  70. RS("Hits")=RS("Hits")+1
  71. RS.Update
  72. Template="<wml>" &vbcrlf
  73. Template=Template & "<head>" &vbcrlf
  74. Template=Template & "<meta http-equiv=""Cache-Control"" content=""no-Cache""/>" &vbcrlf
  75. Template=Template & "<meta http-equiv=""Cache-Control"" content=""max-age=0""/>" &vbcrlf
  76. Template=Template & "</head>" &vbcrlf
  77. Template=Template & "<card id=""main"" title=""" & BlogName & "-" & RS("Title") & """>" &vbcrlf
  78. Template=Template & MainTemplate
  79. Template=Replace(Template,"{$BlogMain}","" & ReplaceLabel(TemplateSub,RS) & "")
  80. Template=Template & "</card>" &vbcrlf
  81. Template=Template & "</wml>" &vbcrlf
  82. Response.Write Template
  83. RS.Close:Set RS=Nothing
  84. End Sub
  85. Function ReplaceLabel(Byval Template,RS)
  86. If KS.S("Action")="CommentSave" Then
  87. Dim HomePage,InsertFace,Content,Anonymous,Title
  88. If KSUser.UserLoginChecked = True Then
  89. AnounName=KSUser.UserName
  90. Else
  91. AnounName="游客"
  92. End If
  93. HomePage="http://wap.kesion.com/"
  94. InsertFace=KS.S("InsertFace")
  95. Content=KS.S("Content")
  96. Title=KS.S("Title")
  97. If Title="" Then Title="回复本文主题"
  98. If AnounName="" Then
  99. ReplaceLabel="<br/><br/>请填写你的昵称!<br/><anchor><prev/>返回重写</anchor><br/><br/>"
  100. Exit Function
  101. End if
  102. If Content="" Then
  103. ReplaceLabel="<br/><br/>请填写评论内容!<br/><anchor><prev/>返回重写</anchor><br/><br/>"
  104. Exit Function
  105. End if
  106. Dim RSS:Set RSS=Server.CreateObject("ADODB.RECORDSET")
  107. RSS.Open "Select * From KS_BlogComment",Conn,1,3
  108. RSS.AddNew
  109. RSS("LogID")=ID
  110. RSS("AnounName")=AnounName
  111. RSS("Title")=Title
  112. RSS("UserName")=KS.S("UserName")
  113. RSS("HomePage")=HomePage
  114. RSS("Content")=InsertFace&Content
  115. RSS("UserIP")=KS.GetIP
  116. RSS("AddDate")=Now
  117. RSS.UpDate
  118. RSS.Close:Set RSS=Nothing
  119. Template=Replace(Template,"{$ShowLogWriteComment}","你的评论发表成功!")
  120. End if
  121. Dim EmotSrc:If RS("Face")<>"0" Then EmotSrc="<img src=""../User/Images/face/" & RS("Face") & ".gif"" alt=""""/>"
  122. Dim TagList,TagsArr:TagsArr=Split(RS("Tags")," ")
  123. If RS("Tags")<>"" Then
  124. TagList="<b>标签:</b>"
  125. For I=0 To Ubound(TagsArr)
  126. If TagsArr(i)<>"" Then
  127. TagList=TagList &"<a href=""Blog.asp?UserName=" & UserName & "&amp;Tag=" & TagsArr(i) &"&amp;" & KS.WapValue & """>" & TagsArr(i) & "</a> "
  128. End If
  129. Next
  130. TagList=TagList &"<br/>"
  131. End If
  132. Dim ContentStr
  133. Dim JFStr:If RS("Best")="1" Then JFStr=" <img src=""../images/jh.gif"" alt=""""/>" Else JFStr=""
  134. If IsNull(RS("Password")) Or RS("PassWord")="" Then
  135. ContentStr=KS.UBBToHTML(KS.LoseHtml(KS.HTMLToUBB(KS.ReplaceTrim(KS.GetEncodeConversion(RS("Content"))))))
  136. ElseIf KS.S("Pass")<>"" Then
  137. If KS.S("Pass")=RS("password") Then
  138. ContentStr=KS.UBBToHTML(KS.LoseHtml(KS.HTMLToUBB(KS.ReplaceTrim(KS.GetEncodeConversion(RS("Content"))))))
  139. Else
  140. ReplaceLabel="<br/><br/>出错啦,您输入的日志密码有误!<br/><br/>"
  141. Exit Function
  142. End if
  143. Else
  144. ReplaceLabel="<br/><br/>请输入日志的查看密码:<input name=""Pass"" maxlength=""30"" value="""" emptyok=""false""/><a href=""List.asp?ID="&ID&"&amp;UserName="&UserName&"&amp;Pass=$(Pass)&amp;" & KS.WapValue & """>查看</a><br/><br/>"
  145. Exit Function
  146. End IF
  147. Template=Replace(Template,"{$ShowLogFace}",EmotSrc)'仅显示日志心情
  148. Template=Replace(Template,"{$ShowLogTitle}",RS("Title"))'仅显示日志标题
  149. Template=Replace(Template,"{$ShowLogBest}",JFStr)
  150. Template=Replace(Template,"{$ShowLogUserName}",RS("UserName"))'仅显示日志作者
  151. Template=Replace(Template,"{$ShowLogAddDate}",KS.DateFormat(Rs("AddDate"),17))'
  152. Template=Replace(Template,"{$ShowLogText}",KS.ReplaceInnerLink(Replace(KS.ContentPagination(ContentStr,200,"List.asp?UserName="&UserName&"&amp;ID="&ID&"&amp;Pass="&KS.S("Pass")&"&amp;" & KS.WapValue & "",False,False),"&","&amp;")))'正文
  153. Template=Replace(Template,"{$ShowLogTags}",TagList)'标签
  154. Template=Replace(Template,"{$ShowLogHits}",RS("Hits"))'阅读次数
  155. Template=Replace(Template,"{$ShowLogReturn}",Conn.Execute("Select Count(ID) From KS_BlogComment Where LogID=" &RS("id"))(0))'回复数
  156. Template=Replace(Template,"{$ShowLogPrev}",ReplacePrevNextArticle(UserName,RS("ID"),"Prev"))'上一篇
  157. Template=Replace(Template,"{$ShowLogNext}",ReplacePrevNextArticle(UserName,RS("ID"),"Next"))'下一篇
  158. Template=Replace(Template,"{$ShowWeather}",KSBCls.GetWeather(RS))'仅显示日志天气
  159. Template=Replace(Template,"{$ShowLogContent}",ShowBlogComment)
  160. Template=Replace(Template,"{$ShowLogWriteComment}",GetWriteComment)
  161. ReplaceLabel=Template
  162. End Function
  163. Function ShowBlogComment()
  164. MaxPerPage = 5
  165. If KS.S("Page") <> "" Then
  166. CurrentPage = KS.ChkClng(KS.G("Page"))
  167. Else
  168. CurrentPage = 1
  169. End If
  170. Dim RSP:set RSP=Server.Createobject("adodb.recordset")
  171. RSP.Open "Select * from KS_BlogComment Where LogID="&ID&" order by AddDate DESC",Conn,1,1
  172. If RSP.EOF And RSP.BOF Then
  173. ShowBlogComment="没有任何回复评论!<br/>"
  174. Else
  175. Dim TotalPut:TotalPut = RSP.RecordCount
  176. If CurrentPage < 1 Then CurrentPage = 1
  177. If (CurrentPage - 1) * MaxPerPage > TotalPut Then
  178. If (TotalPut Mod MaxPerPage) = 0 Then
  179. CurrentPage = TotalPut \ MaxPerPage
  180. Else
  181. CurrentPage = TotalPut \ MaxPerPage + 1
  182. End If
  183. End If
  184. If CurrentPage >1 And (CurrentPage - 1) * MaxPerPage < TotalPut Then
  185. RSP.Move (CurrentPage - 1) * MaxPerPage
  186. Else
  187. CurrentPage = 1
  188. End If
  189. Do While Not RSP.EOF
  190. ShowBlogComment=ShowBlogComment & ReplaceFace(RSP("Content"))
  191. If RSP("UserName")="游客" Then
  192. ShowBlogComment=ShowBlogComment & RSP("UserName") &"("&KS.DateFormat(RSP("AddDate"),17)&")<br/>"
  193. Else
  194. ShowBlogComment=ShowBlogComment & "<a href=""Space.asp?UserName=" & RSP("UserName") & "&amp;" & KS.WapValue & """>" & KS.GetUserRealName(RSP("UserName")) & "</a>("&KS.DateFormat(RSP("AddDate"),17)&")<br/>"
  195. End If
  196. If Not IsNull(RSP("Replay")) or RSP("Replay")<>"" Then
  197. ShowBlogComment=ShowBlogComment & "主人回复:"&KS.LoseHtml(RSP("Replay"))&"<br/>"
  198. End If
  199. RSP.Movenext
  200. I = I + 1
  201. If I >= MaxPerPage Then Exit Do
  202. Loop
  203. ShowBlogComment=ShowBlogComment & KS.ShowPagePara(TotalPut, MaxPerPage, "List.asp", False, "个", CurrentPage, "UserName="&UserName&"&amp;ID="&ID&"&amp;Pass="&KS.S("Pass")&"&amp;" & KS.WapValue & "")
  204. ShowBlogComment=ShowBlogComment & "<br/>"
  205. End If
  206. RSP.close:set RSP=nothing
  207. End Function
  208. Function ReplaceFace(C)
  209. Dim str:str="惊讶|撇嘴|色|发呆|得意|流泪|害羞|闭嘴|睡|大哭|尴尬|发怒|调皮|呲牙|微笑|难过|酷|非典|抓狂|吐|"
  210. Dim strArr:strArr=Split(str,"|")
  211. Dim K
  212. For K=0 To 19
  213. C=Replace(C,"[e"&K &"]","<img src=""" & KS.Setting(3) & "Images/Emot/" & K & ".gif"" alt=""""/>")
  214. Next
  215. ReplaceFace=C
  216. End Function
  217. Function GetWriteComment()
  218. Dim k,str:str="惊讶|撇嘴|色色|发呆|得意|流泪|害羞|闭嘴|睡觉|大哭|尴尬|发怒|调皮|呲牙|微笑|难过|酷|非典|抓狂|吐|"
  219. Dim strArr:strArr=Split(str,"|")
  220. GetWriteComment = "<select name=""InsertFace"">"
  221. GetWriteComment = GetWriteComment & "<option value="""">无</option>"
  222. For k=0 to 19
  223. GetWriteComment = GetWriteComment & "<option value=""[e"&K&"]"">" & strArr(k) & "</option>"
  224. Next
  225. GetWriteComment = GetWriteComment & "</select> "
  226. Dim reSayArry:reSayArry = Array("好帖,要顶!","看帖回帖是美德!","你牛,我顶!","这帖不错,该顶!","支持你!","反对你!")
  227. Randomize
  228. GetWriteComment = GetWriteComment & "<input name=""Content" & Minute(Now) & Second(Now) & """ type=""text"" maxlength=""500"" size=""20"" value="""&reSayArry(Int(Ubound(reSayArry)*Rnd))&"""/> "
  229. GetWriteComment = GetWriteComment & "<anchor>提交<go href=""List.asp?Action=CommentSave&amp;UserName=" & UserName & "&amp;ID=" & ID & "&amp;Pass="&KS.S("Pass")&"&amp;" & KS.WapValue & """ method=""post"">"
  230. GetWriteComment = GetWriteComment & "<postfield name='AnounName' value='$(AnounName" & Minute(Now) & Second(Now) & ")'/>"
  231. GetWriteComment = GetWriteComment & "<postfield name='HomePage' value='$(HomePage)'/>"
  232. GetWriteComment = GetWriteComment & "<postfield name='InsertFace' value='$(InsertFace)'/>"
  233. GetWriteComment = GetWriteComment & "<postfield name='Content' value='$(Content" & Minute(Now) & Second(Now) & ")'/>"
  234. GetWriteComment = GetWriteComment & "</go></anchor><br/>"
  235. End Function
  236. Function ReplacePrevNextArticle(UserName,NowID,TypeStr)
  237. Dim SqlStr
  238. If Trim(TypeStr) = "Prev" Then
  239. SqlStr = " SELECT Top 1 ID,Title From KS_BlogInfo Where UserName='" & UserName & "' And ID<" & NowID & " And Status=0 Order By ID Desc"
  240. ElseIf Trim(TypeStr) = "Next" Then
  241. SqlStr = " SELECT Top 1 ID,Title From KS_BlogInfo Where UserName='" & UserName & "' And ID>" & NowID & " And Status=0 Order By ID Desc"
  242. Else
  243. ReplacePrevNextArticle = ""
  244. Exit Function
  245. End If
  246. Dim RS:Set RS=Server.CreateObject("ADODB.Recordset")
  247. RS.Open SqlStr, Conn, 1, 1
  248. If RS.EOF And RS.BOF Then
  249. ReplacePrevNextArticle = "没有了"
  250. Else
  251. ReplacePrevNextArticle = "<a href=""" & KSBCls.GetCurrLogUrl(RS("ID"),UserName) & """ title=""" & RS("Title") & """>" & RS("title") & "</a>"
  252. End If
  253. RS.Close:Set RS = Nothing
  254. End Function
  255. End Class
  256. %>