c_system_wap.asp
上传用户:saigedz
上传日期:2019-10-14
资源大小:997k
文件大小:30k
源码类别:

中间件编程

开发平台:

HTML/CSS

  1. <%
  2. '///////////////////////////////////////////////////////////////////////////////
  3. '//              Z-Blog
  4. '// 作    者:    朱煊(zx.asd)&(sipo)
  5. '// 版权所有:    RainbowSoft Studio
  6. '// 技术支持:    rainbowsoft@163.com
  7. '// 程序名称:    
  8. '// 程序版本:    
  9. '// 单元名称:    c_function_wap.asp
  10. '// 开始时间:    2006-3-19
  11. '// 最后修改:    2007-1-24
  12. '// 备    注:    WAP函数模块
  13. '///////////////////////////////////////////////////////////////////////////////
  14. Function WapDelArt()
  15. Response.Write WapTitle(ZC_MSG063)
  16. call DelArticle(Request.QueryString("id"))
  17. Call MakeBlogReBuild_Core()
  18. Response.Write "<a href="""&unescape(Request.QueryString("url"))&""">"&ZC_MSG065&"</a><br/>"
  19. 'Response.Write "<a href="""&WapLoginStr&"&amp;act=BlogReBuild"">"&ZC_MSG072&"</a><br/>"
  20. End Function
  21. Function WapDelCom()
  22. Response.Write WapTitle(ZC_MSG063)
  23. Call MakeBlogReBuild_Core()
  24. call DelComment(Request.QueryString("id"),Request.QueryString("log_id"))
  25. Response.Write "<a href="""&unescape(Request.QueryString("url"))&""">"&ZC_MSG065&"</a><br/>"
  26. 'Response.Write "<a href="""&WapLoginStr&"&amp;act=BlogReBuild"">"&ZC_MSG072&"</a><br/>"
  27. End Function
  28. Function WapPostArt()
  29. Response.Write WapTitle(ZC_MSG168)
  30. Call MakeBlogReBuild_Core()
  31. call PostArticle_WAP
  32. 'Response.Write "<a href="""&WapLoginStr&"&amp;act=BlogReBuild"">"&ZC_MSG072&"</a><br/>"
  33. End Function
  34. Function PostArticle_WAP()
  35. Dim s
  36. Dim objRegExp
  37. If Request.Form("edtID")<>"0" Then
  38. Dim objTestArticle
  39. Set objTestArticle=New TArticle
  40. If objTestArticle.LoadInfobyID(Request.Form("edtID")) Then
  41. If Not((objTestArticle.AuthorID=BlogUser.ID) Or (CheckRights("Root")=True)) Then Exit Function
  42. Else
  43. Call ShowError(9)
  44. End If
  45. End If
  46. Dim objArticle
  47. Set objArticle=New TArticle
  48. objArticle.ID=Request.Form("edtID")
  49. objArticle.CateID=Request.Form("edtCateID")
  50. objArticle.AuthorID=Request.Form("edtAuthorID")
  51. objArticle.Level=Request.Form("edtLevel")
  52. objArticle.PostTime=Request.Form("edtYear") & "-" & Request.Form("edtMonth") & "-" & Request.Form("edtDay") & " " &  Request.Form("edtTime")
  53. objArticle.Title=Request.Form("edtTitle")
  54. objArticle.Tag=ParseTag(Request.Form("edtTag"))
  55. objArticle.Alias=Request.Form("edtAlias")
  56. objArticle.Istop=Request.Form("edtIstop")
  57. objArticle.Intro=Request.Form("txaIntro")
  58. objArticle.Content=Request.Form("txaContent")
  59. If objArticle.Post Then
  60. Call BuildArticle(objArticle.ID,True,True)
  61. Call MakeBlogReBuild_Core()
  62. PostArticle_WAP=True
  63. End If
  64. End Function
  65. Function WapEdtArt()
  66. Dim Log_ID
  67. Response.Write WapTitle(ZC_MSG168)
  68. Response.Write ZC_MSG060&":<input emptyok=""false"" name=""edtTitle"" size=""15"" maxlength=""100"" value="""" /><br/>"
  69. Response.Write ZC_MSG012&":<select name=""edtCateID"">"
  70. GetCategory()
  71. Dim Category
  72. For Each Category in Categorys
  73. If IsObject(Category) Then
  74. Response.Write "<option value="""&Category.ID&""">"&TransferHTML(Category.Name,"[html-format]")&"</option>"
  75. End If
  76. Next
  77. Response.Write "</select><br/>"
  78. Response.Write ZC_MSG003&":<select name=""edtAuthorID"">"
  79. Response.Write "<option value="""&BlogUser.ID&""">"&TransferHTML(BlogUser.Name,"[html-format]")&"</option>"
  80. Response.Write "</select><br/>"
  81. Response.Write ZC_MSG061&"<select name=""edtLevel"">"
  82. Dim i
  83. For i=Ubound(ZVA_Article_Level_Name) to 1 step -1
  84. Response.Write "<option value="""& i &""">"& ZVA_Article_Level_Name(i) &"</option>"
  85. Next
  86. Response.Write "</select><br/>"
  87. Response.Write ZC_MSG062&":<input emptyok=""false"" name=""edtYear"" size=""10"" value="""&Year(GetTime(now()))&""" />-<input name=""edtMonth"" size=""10"" value="""&Month(GetTime(now()))&""" />-<input name=""edtDay""  size=""10"" value="""&Day(GetTime(now()))&""" />-<input name=""edtTime"" size=""12"" value="""& Hour(GetTime(now()))&":"&Minute(GetTime(now()))&":"&Second(GetTime(now()))&""" /><br/>"
  88. Response.Write ZC_MSG138&":<input emptyok=""true"" name=""edtTag"" size=""15"" maxlength=""100"" value="""" /><br/>"
  89. Response.Write ZC_MSG147&":<input emptyok=""true"" size=""10"" name=""edtAlias"" maxlength=""100"" value="""" />."&ZC_STATIC_TYPE&"<br/>"
  90. Response.Write ZC_MSG055&":<input emptyok=""false"" name=""txaContent"" size=""20"" maxlength=""5000"" value="""" /><br/>"
  91. Response.Write ZC_MSG016&":<input emptyok=""true"" name=""txaIntro"" size=""20"" maxlength=""1000"" value="""" /><br/>"
  92. Response.Write "<anchor>["&ZC_MSG087&"]<go href="""&WapLoginStr&"&amp;act=PostArt&amp;inpId="&Log_ID&""" method=""post"">"
  93. Response.Write " <postfield name=""edtID"" value=""0"" />"
  94. Response.Write " <postfield name=""edtTitle"" value=""$(edtTitle:n)"" />"
  95. Response.Write " <postfield name=""edtAuthorID"" value=""$(edtAuthorID:n)"" />"
  96. Response.Write " <postfield name=""edtLevel"" value=""$(edtLevel:n)"" />"
  97. Response.Write " <postfield name=""edtYear"" value=""$(edtYear:n)"" />"
  98. Response.Write " <postfield name=""edtMonth"" value=""$(edtMonth:n)"" />"
  99. Response.Write " <postfield name=""edtDay"" value=""$(edtDay:n)"" />"
  100. Response.Write " <postfield name=""edtTime"" value=""$(edtTime:n)"" />"
  101. Response.Write " <postfield name=""edtTag"" value=""$(edtTag:n)"" />"
  102. Response.Write " <postfield name=""edtAlias"" value=""$(edtAlias:n)"" />"
  103. Response.Write " <postfield name=""edtCateID"" value=""$(edtCateID:n)"" />"
  104. Response.Write " <postfield name=""txaContent"" value=""$(txaContent:n)"" />"
  105. Response.Write " <postfield name=""txaIntro"" value=""$(txaIntro:n)"" />"
  106. Response.Write "</go>"
  107. Response.Write "</anchor>"
  108. End Function
  109. Function WapCate()
  110. Dim Category
  111. Response.Write WapTitle(ZC_MSG214)
  112. For Each Category in Categorys
  113. If IsObject(Category) Then
  114. Response.Write Category.ID&",<a href="""&WapLoginStr&"&amp;act=Main&amp;cate="&Category.ID&""">"&TransferHTML(Category.Name,"[html-format]")&"("&Category.Count&")</a><br/>"
  115. End If
  116. Next
  117. End Function
  118. Function WapStat()
  119. Response.Write WapTitle(ZC_MSG029)
  120. Response.Write  Replace(Replace(LoadFromFile(BlogPath & "/INCLUDE/statistics.asp","utf-8"),"<li>",""),"</li>","<br/>")
  121. End Function
  122. Function WapAddCom(PostType)
  123. If ZC_WAPCOMMENT_ENABLE=False Then Call ShowError(40): Exit Function
  124. Dim log_ID,Author,Content,Email,HomePage
  125. log_ID=Request("inpId")
  126. Author=Request.Form("inpName")
  127. Content=Request.Form("inpArticle")
  128. Email=Request.Form("inpEmail")
  129. HomePage=Request.Form("inpHomePage")
  130. Call CheckParameter(log_ID,"int",0)
  131. If log_ID=0 Then Call ShowError(3): Exit Function
  132. Response.Write WapTitle(ZC_MSG211)
  133.     'Response.Write "<input type=""hidden"" name=""inpId"" id=""inpId"" value="""&Log_ID&""" />"
  134.   
  135.     If PostType<>0 Then
  136.     Response.Write ZVA_ErrorMsg(PostType)&"<br/>"
  137. End If
  138. If PostType=31 Then
  139. Response.Write ZC_MSG001&"*:<input type=""text"" emptyok=""false"" name=""inpName"" size=""12"" value="""&BlogUser.Name&""" maxlength="""&ZC_USERNAME_MAX&"""/><br/>"
  140. Else
  141. Response.Write ZC_MSG001&"*:<input type=""text"" emptyok=""false"" name=""inpName"" size=""12"" value="""&Author&""" maxlength="""&ZC_USERNAME_MAX&"""/><br/>"
  142. End If
  143. If PostType=6 Then
  144. Response.Write ZC_MSG002&":<input type=""password"" emptyok=""false"" name=""inpPass"" size=""12"" value="""" maxlength="""&ZC_PASSWORD_MAX&"""/><br/>"
  145. End If
  146. Response.Write ZC_MSG053&":<input type=""text"" emptyok=""true"" name=""inpEmail"" size=""12"" value="""&Email&""" maxlength="""&ZC_EMAIL_MAX&"""/><br/>"
  147. Response.Write ZC_MSG054&":<input type=""text"" emptyok=""true"" name=""inpHomePage"" size=""12"" value="""&HomePage&""" maxlength="""&ZC_HOMEPAGE_MAX&""" /><br/>"
  148. Response.Write ZC_MSG055&"*("&ZC_MSG055&":1000):<br/><input type=""text"" emptyok=""false"" name=""inpArticle"" size=""20"" maxlength="""&ZC_CONTENT_MAX&""" value="""&Content&"""></input><br/>"
  149. Response.Write "<anchor title=""post"">["&ZC_MSG087&"]"
  150. Response.Write "<go href="""&WapLoginStr&"&amp;act=PostCom&amp;inpId="&Log_ID&""" method=""post"">"
  151. Response.Write "<postfield name=""username"" value=""$(inpName:n)"" />"
  152. If PostType=6 Then
  153. Response.Write "<postfield name=""password"" value=""$(inpPass:n)"" />"
  154. End If
  155. Response.Write "<postfield name=""email"" value=""$(inpEmail:n)"" />"
  156. Response.Write "<postfield name=""url"" value=""$(inpHomePage:n)"" />"
  157. Response.Write "<postfield name=""content"" value=""$(inpArticle:n)"" />"
  158. Response.Write "</go></anchor><br/>"
  159. End Function
  160. Function WapPostCom()
  161. If ZC_WAPCOMMENT_ENABLE=False Then Call ShowError(40): Exit Function
  162. If Not IsEmpty(Request.Form("password")) Then
  163. Response.Cookies("password")=md5(Request.Form("password"))
  164. session(ZC_BLOG_CLSID&"password")=md5(Request.Form("password"))
  165.     Response.Cookies("username")=Request.Form("username")
  166. session(ZC_BLOG_CLSID&"username")=Request.Form("username")
  167. Call WapCheckLogin
  168. End IF
  169. Dim objComment
  170. Dim objArticle
  171. Set objComment=New TComment
  172. Set objArticle=New TArticle
  173. objComment.log_ID=Request("inpID")
  174. objComment.AuthorID=BlogUser.ID
  175. objComment.Author=Request.Form("username")
  176. objComment.Content=Request.Form("content")
  177. objComment.Email=Request.Form("email")
  178. objComment.HomePage=Request.Form("url")
  179. If Not CheckRegExp(objComment.Author,"[username]") Then Call  WapAddCom(15) :Exit Function
  180. IF Len(objComment.Email)>0 Then
  181. If Not CheckRegExp(objComment.Email,"[email]") Then Call  WapAddCom(29) :Exit Function
  182. End If
  183. IF Len(objComment.HomePage)>0 Then
  184. If InStr(objComment.HomePage,"http")=0 Then objComment.HomePage="http://" & objComment.HomePage
  185. If Not CheckRegExp(objComment.HomePage,"[homepage]") Then Call WapAddCom(30) :Exit Function
  186. End If
  187. Dim objUser
  188. For Each objUser in Users
  189. If IsObject(objUser) Then
  190.     '没有登陆
  191. If (UCase(objUser.Name)=UCase(objComment.Author)) And (objUser.ID<>objComment.AuthorID) Then
  192. Call WapAddCom(6)
  193. Exit Function
  194. End If
  195. '已经登陆了用不同的用户名
  196. If (objUser.ID=objComment.AuthorID) And (UCase(objUser.Name)<>UCase(objComment.Author)) Then
  197. Call WapAddCom(31)
  198. Exit Function
  199. End If
  200. '完全符合
  201. If (objUser.ID=objComment.AuthorID) And (UCase(objUser.Name)=UCase(objComment.Author)) Then
  202. objComment.Author=objUser.Name
  203. End If
  204. End If
  205. Next
  206. Dim objRS
  207. Dim strSpamIP
  208. Dim strSpamContent
  209. Set objRS=objConn.Execute("SELECT [comm_IP],[comm_Content] FROM [blog_Comment] WHERE [comm_ID]= ( SELECT MAX(comm_ID) FROM [blog_Comment] )")
  210. If (Not objRS.bof) And (Not objRS.eof) Then
  211. strSpamIP=objRS("comm_IP")
  212. strSpamContent=objRS("comm_Content")
  213. End If
  214. objRS.Close
  215. Set objRS=Nothing
  216. If (strSpamContent=objComment.Content) Then
  217. Call WapAddCom(39)
  218. Exit Function
  219. End If
  220. If objComment.Post Then
  221. If objArticle.LoadInfoByID(objComment.log_ID) Then
  222. Call BuildArticle(objArticle.ID,False,False)
  223. BlogReBuild_Comments
  224. WapPostCom=True
  225. End If
  226. End if
  227. Response.Write WapTitle(ZC_MSG211)
  228.     Response.Write "<a href="""&WapLoginStr&"&amp;act=View&amp;id="&objComment.log_ID&""">"&ZC_MSG065&ZC_MSG048&"</a><br/>"
  229. Set objComment=Nothing
  230. End Function
  231. Function WapLogin()
  232. Dim User,Password
  233. User=Request.Form("username")
  234. Password=Request.Form("password")
  235. Call CheckParameter(User,"sql",Empty)
  236. Call CheckParameter(Password,"sql",Empty)
  237. If IsEmpty(User) OR IsEmpty(Password) Then
  238. Response.Write WapTitle(ZC_MSG009)
  239. Response.Write ZC_MSG001&":<input type=""text"" name=""username"" size=""12"" value="""" /><br/>"
  240. Response.Write ZC_MSG002&":<input type=""password"" name=""password"" size=""12"" value="""" /><br/>"
  241. Response.Write "<anchor title=""post"">["&ZC_MSG087&"]<go href="""&ZC_FILENAME_WAP&"?act=Login"" method=""post""><postfield name=""username"" value=""$(username:n)"" /><postfield name=""password"" value=""$(password:n)"" /></go></anchor><br/>"
  242. Else
  243. Response.Cookies("password")=md5(Password)
  244. session(ZC_BLOG_CLSID&"password")=md5(Password)
  245. Response.Cookies("username")=User
  246. session(ZC_BLOG_CLSID&"username")=User
  247. If BlogUser.Verify=False Then
  248. Call ShowError(8)
  249. Else
  250. Response.Write WapTitle(ZC_MSG009)
  251. End If
  252. End If
  253. End Function
  254. Function WapMenu()
  255.         Response.Write WapTitle(ZC_BLOG_TITLE)
  256. Response.Write "<a href="""&WapLoginStr&"&amp;act=Login"">"&ZC_MSG009&"</a><br/>"
  257. Response.Write "<a href="""&WapLoginStr&"&amp;act=Com"">"&ZC_MSG027&"</a><br/>"
  258. Response.Write "<a href="""&WapLoginStr&"&amp;act=Main"">"&ZC_MSG032&"</a><br/>"
  259. Response.Write "<a href="""&WapLoginStr&"&amp;act=Cate"">"&ZC_MSG214&"</a><br/>"
  260. Response.Write "<a href="""&WapLoginStr&"&amp;act=Stat"">"&ZC_MSG029&"</a><br/>"
  261. If BlogUser.Level<=3 Then
  262. Response.Write "<a href="""&WapLoginStr&"&amp;act=AddArt"">"&ZC_MSG168&"</a><br/>"
  263. 'Response.Write "<a href="""&WapLoginStr&"&amp;act=BlogReBuild"">"&ZC_MSG072&"</a><br/>"
  264. End If
  265. End Function
  266. Function WapMain()
  267.         Response.Write WapTitle(ZC_BLOG_TITLE)
  268. Response.Write WapExport(Request("page"),Request("cate"),Request("auth"),Request("date"),Request("tags"),ZC_DISPLAY_MODE_ALL)
  269. Response.Write WapExportBar(Request("page"),intPageCount,Request("cate"),Request("auth"),Request("date"),Request("tags"))
  270. End Function
  271. Function WapCom()
  272.         Dim i,CurrentPage,log_ID
  273. CurrentPage=Request.QueryString("page")
  274. log_ID=Request.QueryString("id")
  275. Call CheckParameter(CurrentPage,"int",1)
  276. Call CheckParameter(log_ID,"int",0)
  277. Dim Article
  278. If log_ID<>0 Then
  279. Set Article=New TArticle
  280. If Article.LoadInfoByID(log_ID) Then
  281. If Article.Level=1 Then Response.Write WapTitle(ZVA_Article_Level_Name(1))&ZVA_ErrorMsg(9):Exit Function
  282. If Article.Level=2 Then
  283. If Not CheckRights("Root") Then
  284. If (Article.AuthorID<>BlogUser.ID) Then Response.Write WapTitle(ZVA_Article_Level_Name(2))&ZVA_ErrorMsg(6):Exit Function
  285. End If
  286. End If
  287. End If
  288. End If
  289. Dim objRS
  290. Set objRS=Server.CreateObject("ADODB.Recordset")
  291. objRS.CursorType = adOpenKeyset
  292. objRS.LockType = adLockReadOnly
  293. objRS.ActiveConnection=objConn
  294. If log_ID=0 Then 
  295. objRS.Source="SELECT blog_Comment.* , blog_Article.log_ID, blog_Article.log_Title FROM blog_Comment INNER JOIN blog_Article ON blog_Comment.log_ID = blog_Article.log_ID ORDER BY blog_Comment.comm_PostTime DESC"
  296. Response.Write WapTitle(ZC_MSG027)&ZC_MSG027&"<br/><br/>"
  297. Else
  298. objRS.Source="SELECT blog_Comment.* , blog_Article.log_ID, blog_Article.log_Title FROM blog_Comment INNER JOIN blog_Article ON blog_Comment.log_ID = blog_Article.log_ID WHERE blog_Comment.log_ID="&log_ID&" ORDER BY blog_Comment.comm_PostTime DESC"
  299. Response.Write WapTitle(Article.Title&"-"&ZC_MSG013)&Article.Title&"<br/><br/>"
  300. End If
  301. objRS.Open()
  302. If (Not objRS.bof) And (Not objRS.eof) Then
  303. Dim strCTemplate,ComRecordCount
  304. strCTemplate=GetTemplate("TEMPLATE_WAP_ARTICLE_COMMENT")
  305. objRS.PageSize = ZC_COMMENT_COUNT_WAP
  306. intPageCount=objRS.PageCount
  307. ComRecordCount=objRS.RecordCount
  308. objRS.AbsolutePage = CurrentPage
  309. For i=1 To objRS.PageSize
  310. Dim objComment
  311. Set objComment=New TComment
  312. If objComment.LoadInfoByArray(Array(objRS("comm_ID"),objRS("blog_Comment.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"))) Then
  313. Dim strC_Count
  314. strC_Count=ComRecordCount-((CurrentPage-1)*ZC_COMMENT_COUNT_WAP+i)+1
  315. ReDim Preserve aryStrC(i)
  316. aryStrC(i)=strCTemplate
  317. aryStrC(i)=Replace(aryStrC(i),"<#ZC_FILENAME_WAP#>",ZC_FILENAME_WAP)
  318. aryStrC(i)=Replace(aryStrC(i),"<#article/id#>",objRS("blog_Comment.log_ID"))
  319. aryStrC(i)=Replace(aryStrC(i),"<#article/title#>",objRS("log_Title"))
  320. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/id#>",objComment.ID)
  321. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/name#>",objComment.Author)
  322. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/url#>",objComment.HomePage)
  323. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/email#>",objComment.SafeEmail)
  324. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/posttime#>",FormatDateTime(objComment.PostTime,vbShortDate)&" "&FormatDateTime(objComment.PostTime,vbShortTime))
  325. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/content#>",TransferHTML(TransferHTML(UBBCode(objComment.HtmlContent,"[face][link][autolink][font][code][image][typeset][media][flash][key][upload]"),"[html-japan][vbCrlf][upload]"),"[wapnohtml]"))
  326. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/count#>",strC_Count)
  327. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/authorid#>",objComment.AuthorID)
  328. aryStrC(i)=Replace(aryStrC(i),"<#article/comment/firstcontact#>",objComment.FirstContact)
  329.     
  330. If BlogUser.Level<=3 Then
  331. aryStrC(i)=Replace(aryStrC(i),"<#url#>",Escape(ZC_BLOG_HOST&ZC_FILENAME_WAP&"?mode=WAP&amp;"&Replace(Request.QueryString,"&","&amp;")))
  332. aryStrC(i)=Replace(aryStrC(i),"<#adbegin#>","")
  333. aryStrC(i)=Replace(aryStrC(i),"<#adend#>","")
  334. Else
  335. Dim objRegExp
  336. Set objRegExp=New RegExp
  337. objRegExp.IgnoreCase =True
  338. objRegExp.Global=True
  339. objRegExp.Pattern="<#adbegin#>(.+)<#adend#>"
  340. aryStrC(i)= objRegExp.Replace(aryStrC(i),"")
  341. End If
  342. Dim aryTemplateTagsName,aryTemplateTagsValue
  343. aryTemplateTagsName=TemplateTagsName
  344. aryTemplateTagsValue=TemplateTagsValue
  345. aryTemplateTagsName(0)="BlogTitle"
  346. aryTemplateTagsValue(0)=ZC_BLOG_TITLE
  347. Dim k
  348. For k=0 to UBound(aryTemplateTagsName)
  349.     aryStrC(i)=Replace(aryStrC(i),"<#" & aryTemplateTagsName(k) & "#>",aryTemplateTagsValue(k))
  350. Next
  351. End If
  352. Set objComment=Nothing
  353. objRS.MoveNext
  354. If objRS.EOF Then Exit For
  355. Next
  356. Else
  357. Exit Function
  358. End If
  359. objRS.Close()
  360. Set objRS=Nothing
  361. Dim strC
  362. strC=Join(aryStrC)
  363. Dim PageBar
  364. PageBar="<a href="""&WapLoginStr&"&amp;act=Com&amp;id="&log_ID&"&amp;Page=1"">[&lt;&lt;]</a>"
  365. For i=CurrentPage-Cint(ZC_COMMENT_PAGEBAR_COUNT_WAP/2) to CurrentPage+Cint(ZC_COMMENT_PAGEBAR_COUNT_WAP/2) 
  366. If i>0 and i<=intPageCount Then
  367. If i=CurrentPage Then
  368. PageBar=PageBar&"<a href="""&WapLoginStr&"&amp;act=Com&amp;id="&log_ID&"&amp;Page="&i&""">[["&i&"]]</a>"
  369. Else
  370. PageBar=PageBar&"<a href="""&WapLoginStr&"&amp;act=Com&amp;id="&log_ID&"&amp;Page="&i&""">["&i&"]</a>"
  371. End If
  372. End If
  373. Next
  374. PageBar=PageBar&"<a href="""&WapLoginStr&"&amp;act=Com&amp;id="&log_ID&"&amp;Page="&intPageCount&""">[&gt;&gt;]</a>"
  375. Response.Write strC&PageBar
  376. End Function
  377. Function WapView()
  378. Dim Article,ZC_SINGLE_START,CurrentPage,i,log_ID
  379. CurrentPage=Request.QueryString("page")
  380. log_ID=Request.QueryString("id")
  381. Call CheckParameter(CurrentPage,"int",1)
  382. Call CheckParameter(log_ID,"int",0)
  383. If log_ID=0 Then Call ShowError(3) : Exit Function
  384. Set Article=New TArticle
  385. If Article.LoadInfoByID(log_ID) Then
  386. 'If BlogUser.Level>
  387. If Article.Level=1 Then Response.Write WapTitle(ZVA_Article_Level_Name(1))&ZVA_ErrorMsg(9):Exit Function
  388. If Article.Level=2 Then
  389. If Not CheckRights("Root") Then
  390. If (Article.AuthorID<>BlogUser.ID) Then Response.Write WapTitle(ZVA_Article_Level_Name(2))&ZVA_ErrorMsg(6):Exit Function
  391. End If
  392. End If
  393.         Response.Write WapTitle(Article.Title)
  394. Dim ArticleContent,PageCount,PageBar
  395. ArticleContent=TransferHTML(TransferHTML(UBBCode(Article.Content,"[face][link][autolink][font][code][image][typeset][media][flash][key][upload]"),"[html-japan][vbCrlf][upload]"),"[wapnohtml]")
  396. PageCount = Int(Len(ArticleContent)/ZC_SINGLE_SIZE_WAP) + 1
  397. ZC_SINGLE_START=Cint((CurrentPage-1)*ZC_SINGLE_SIZE_WAP+1)
  398. If ZC_SINGLE_START<1 Then ZC_SINGLE_START=1
  399. ArticleContent=Mid(ArticleContent,ZC_SINGLE_START,ZC_SINGLE_SIZE_WAP)
  400. ArticleContent=TransferHTML(ArticleContent,"[html-format][wapnohtml][nbsp-br]")
  401.     PageBar="<br/><a href="""&WapLoginStr&"&amp;act=View&amp;id="&log_ID&"&amp;Page=1"">[&lt;&lt;]</a>"
  402. For i=CurrentPage-Cint(ZC_SINGLE_PAGEBAR_COUNT_WAP/2) to CurrentPage+Cint(ZC_SINGLE_PAGEBAR_COUNT_WAP/2)
  403. If i>0 and i<=PageCount Then
  404. If i=CurrentPage Then
  405. PageBar=PageBar&"<a href="""&WapLoginStr&"&amp;act=View&amp;id="&log_ID&"&amp;Page="&i&""">[["&i&"]]</a>"
  406. Else
  407. PageBar=PageBar&"<a href="""&WapLoginStr&"&amp;act=View&amp;id="&log_ID&"&amp;Page="&i&""">["&i&"]</a>"
  408. End If
  409. End If
  410. Next
  411. PageBar=PageBar&"<a href="""&WapLoginStr&"&amp;act=View&amp;id="&log_ID&"&amp;Page="&PageCount&""">[&gt;&gt;]</a>"
  412. ArticleContent=ArticleContent&PageBar
  413. If Article.Export(ZC_DISPLAY_MODE_ALL) Then
  414.     Article.template_Wap="wap_single"
  415. Article.Build
  416. Article.htmlWAP=Replace(Article.htmlWAP,"<#article/PageContent#>",ArticleContent)
  417. Article.htmlWAP=Replace(Article.htmlWAP,"<#ZC_FILENAME_WAP#>",ZC_FILENAME_WAP)
  418.     If BlogUser.Level<=3 Then
  419. Article.htmlWAP=Replace(Article.htmlWAP,"<#url#>",Escape(ZC_BLOG_HOST&ZC_FILENAME_WAP&"?mode=WAP&amp;"&Replace(Request.QueryString,"&","&amp;")))
  420. Article.htmlWAP=Replace(Article.htmlWAP,"<#adbegin#>","")
  421. Article.htmlWAP=Replace(Article.htmlWAP,"<#adend#>","")
  422. Else
  423. Dim objRegExp
  424. Set objRegExp=New RegExp
  425. objRegExp.IgnoreCase =True
  426. objRegExp.Global=True
  427. objRegExp.Pattern="<#adbegin#>(.+)<#adend#>"
  428. Article.htmlWAP= objRegExp.Replace(Article.htmlWAP,"")
  429. End If
  430. Response.Write Article.htmlWAP
  431. End If
  432. End If
  433. End Function
  434. Function WapExport(intPage,intCateId,intAuthorId,dtmYearMonth,strTagsName,intType)
  435. Dim i,j
  436. Dim objRS
  437. Dim objArticle
  438. Call CheckParameter(intPage,"int",1)
  439. Call CheckParameter(intCateId,"int",Empty)
  440. Call CheckParameter(intAuthorId,"int",Empty)
  441. Call CheckParameter(dtmYearMonth,"dtm",Empty)
  442. Dim Title
  443. Title=ZC_BLOG_SUBTITLE
  444. Set objRS=Server.CreateObject("ADODB.Recordset")
  445. objRS.CursorType = adOpenKeyset
  446. objRS.LockType = adLockReadOnly
  447. objRS.ActiveConnection=objConn
  448. objRS.Source="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] FROM [blog_Article] WHERE ([log_ID]>0) AND ([log_Level]>1)"
  449. If Not IsEmpty(intCateId) Then
  450. objRS.Source=objRS.Source & "AND([log_CateID]="&intCateId&")"
  451. On Error Resume Next
  452. Title=Categorys(intCateId).Name
  453. Err.Clear
  454. End if
  455. If Not IsEmpty(intAuthorId) Then
  456. objRS.Source=objRS.Source & "AND([log_AuthorID]="&intAuthorId&")"
  457. On Error Resume Next
  458. Title=Users(intAuthorId).Name
  459. Err.Clear
  460. End if
  461. If IsDate(dtmYearMonth) Then
  462. Dim y
  463. Dim m
  464. Dim ny
  465. Dim nm
  466. If IsDate(dtmYearMonth) Then
  467. dtmYearMonth=CDate(dtmYearMonth)
  468. Else
  469. Call ShowError(3)
  470. End If
  471. y=year(dtmYearMonth)
  472. m=month(dtmYearMonth)
  473. ny=y
  474. nm=m+1
  475. If m=12 Then ny=ny+1:nm=1
  476. objRS.Source=objRS.Source & "AND([log_PostTime] BETWEEN #"&y&"-"&m&"-1# AND #"&ny&"-"&nm&"-1#)"
  477. Application.Lock
  478. If Year(dtmYearMonth)=Year(GetTime(now())) And Month(dtmYearMonth)=Month(GetTime(now())) Then
  479. Template_Calendar=Application(ZC_BLOG_CLSID & "CACHE_INCLUDE_CALENDAR")
  480. End If
  481. Application.UnLock
  482. Title=Year(dtmYearMonth) & " " & ZVA_Month(Month(dtmYearMonth))
  483. End If
  484. If Not IsEmpty(strTagsName) Then
  485. On Error Resume Next
  486. Dim Tag
  487. For Each Tag in Tags
  488. If IsObject(Tag) Then
  489. If UCase(Tag.Name)=UCase(strTagsName) Then
  490. objRS.Source=objRS.Source & "AND([log_Tag] LIKE '%{" & Tag.ID & "}%')"
  491. End If
  492. End If
  493. Next
  494. Err.Clear
  495. Title=strTagsName
  496. End If
  497. objRS.Source=objRS.Source & "ORDER BY [log_PostTime] DESC,[log_ID] DESC"
  498. objRS.Open()
  499. If (Not objRS.bof) And (Not objRS.eof) Then
  500. objRS.PageSize = ZC_DISPLAY_COUNT_WAP
  501. intPageCount=objRS.PageCount
  502. objRS.AbsolutePage = intPage
  503. For i = 1 To objRS.PageSize
  504. ReDim Preserve aryArticleList(i)
  505. Set objArticle=New TArticle
  506. 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))) Then
  507. If objArticle.Export(intType)= True Then
  508. aryArticleList(i)=objArticle.Template_Article_Multi_WAP
  509. End If
  510. End If
  511. Set objArticle=Nothing
  512. objRS.MoveNext
  513. If objRS.EOF Then Exit For
  514. Next
  515. Else
  516. Exit Function
  517. End If
  518. objRS.Close()
  519. Set objRS=Nothing
  520. Dim Template_Article_Multi
  521. Template_Article_Multi=Join(aryArticleList)
  522. Dim Template_Calendar
  523. If IsEmpty(Template_Calendar) Or Len(Template_Calendar)=0 Then
  524. Application.Lock
  525. Template_Calendar=Application(ZC_BLOG_CLSID & "CACHE_INCLUDE_CALENDAR")
  526. Application.UnLock
  527. End If
  528. Dim aryTemplateTagsName,aryTemplateTagsValue
  529. aryTemplateTagsName=TemplateTagsName
  530. aryTemplateTagsValue=TemplateTagsValue
  531. aryTemplateTagsName(0)="BlogTitle"
  532. aryTemplateTagsValue(0)=Title
  533. j=UBound(aryTemplateTagsName)
  534. For i=0 to j
  535. Template_Article_Multi=Replace(Template_Article_Multi,"<#" & aryTemplateTagsName(i) & "#>",aryTemplateTagsValue(i))
  536. Next
  537. Template_Article_Multi=Replace(Template_Article_Multi,"<#ZC_FILENAME_WAP#>",ZC_FILENAME_WAP)
  538. If BlogUser.Level<=3 Then
  539. Template_Article_Multi=Replace(Template_Article_Multi,"<#url#>",Escape(ZC_BLOG_HOST&ZC_FILENAME_WAP&"?mode=WAP&amp;"&Replace(Request.QueryString,"&","&amp;")))
  540. Template_Article_Multi=Replace(Template_Article_Multi,"<#adbegin#>","")
  541. Template_Article_Multi=Replace(Template_Article_Multi,"<#adend#>","")
  542. Else
  543. Dim objRegExp
  544. Set objRegExp=New RegExp
  545. objRegExp.IgnoreCase =True
  546. objRegExp.Global=True
  547. objRegExp.Pattern="<#adbegin#>(.+)<#adend#>"
  548. Template_Article_Multi= objRegExp.Replace(Template_Article_Multi,"")
  549. End If
  550. WapExport=Template_Article_Multi
  551. End Function
  552. Function WapExportBar(intNowPage,intAllPage,intCateId,intAuthorId,dtmYearMonth,strTagsName)
  553. Dim i
  554. Dim s
  555. Dim t
  556. Dim strPageBar
  557. If Not IsEmpty(intCateId) Then t=t & "cate=" & intCateId & "&amp;"
  558. If Not IsEmpty(dtmYearMonth) Then t=t & "date=" & Year(dtmYearMonth) & "-" & Month(dtmYearMonth) & "&amp;"
  559. If Not IsEmpty(intAuthorId) Then t=t & "auth=" & intAuthorId & "&amp;"
  560. If Not (strTagsName="") Then t=t & "tags=" & Server.URLEncode(strTagsName) & "&amp;"
  561. If intAllPage>0 Then
  562. Dim a,b
  563. s=""&WapLoginStr&"&amp;act=Main&amp;"& t &"page=1"
  564. strPageBar="<a href=""<#pagebar/page/url#>"">[<#pagebar/page/number#>]</a>"
  565. strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
  566. strPageBar=Replace(strPageBar,"<#pagebar/page/number#>","&lt;&lt;")
  567. Dim Template_PageBar
  568. Template_PageBar=Template_PageBar & strPageBar
  569. If intAllPage>ZC_PAGEBAR_COUNT_WAP Then
  570. a=intNowPage
  571. b=intNowPage+ZC_PAGEBAR_COUNT_WAP
  572. If a>ZC_PAGEBAR_COUNT_WAP Then a=a-1:b=b-1
  573. If b>intAllPage Then b=intAllPage:a=intAllPage-ZC_PAGEBAR_COUNT_WAP
  574. Else
  575. a=1:b=intAllPage
  576. End If
  577. For i=a to b
  578. If i>0 Then
  579. s=""&WapLoginStr&"&amp;act=Main&amp;"& t &"page="& i
  580. strPageBar="<a href=""<#pagebar/page/url#>"">[<#pagebar/page/number#>]</a>"
  581. strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
  582. strPageBar=Replace(strPageBar,"<#pagebar/page/number#>",i)
  583. Template_PageBar=Template_PageBar & strPageBar
  584. End If
  585. Next
  586. s=""&WapLoginStr&"&amp;act=Main&amp;"& t &"page="& intAllPage
  587. strPageBar="<a href=""<#pagebar/page/url#>"">[<#pagebar/page/number#>]</a>"
  588. strPageBar=Replace(strPageBar,"<#pagebar/page/url#>",s)
  589. strPageBar=Replace(strPageBar,"<#pagebar/page/number#>","&gt;&gt;")
  590. Template_PageBar=Template_PageBar & strPageBar
  591. Dim Template_PageBar_Previous
  592. If intNowPage=1 Then
  593. Template_PageBar_Previous=""
  594. Else
  595. Template_PageBar_Previous="<a href="""&WapLoginStr&"&amp;act=Main&amp;"& t &"page="& intNowPage-1 &""">"&ZC_MSG156&"</a>"
  596. End If
  597. Dim Template_PageBar_Next
  598. If intNowPage=intAllPage Then
  599. Template_PageBar_Next=""
  600. Else
  601. Template_PageBar_Next="<a href="""&WapLoginStr&"&amp;act=Main&amp;"& t &"page="& intNowPage+1 &""">"&ZC_MSG155&"</a>"
  602. End If
  603. End If
  604. WapExportBar=Template_PageBar
  605. End Function
  606. Public Function WapTitle(Str)
  607. WapTitle="<card title="""&Str&""" id=""card1"">"&vbnewline&"<p>"&WapCheckLogin&"</p><p>"&vbnewline
  608. End Function
  609. Public Function WapError()
  610. dim ID
  611. ID=Request("id")
  612. If Not IsNumeric(ID) Then
  613. ID=0
  614. ElseIf CINT(ID)>Ubound(ZVA_ErrorMsg) Or CINT(ID)<0 Then
  615. ID=0
  616. End If
  617. Response.Write WapTitle(ZVA_ErrorMsg(ID))&ZVA_ErrorMsg(ID)
  618. End Function
  619.    Function WapLoginStr()
  620.    WapLoginStr=ZC_BLOG_HOST&ZC_FILENAME_WAP&"?mode=WAP"
  621. End Function
  622.  
  623.  Function WapCheckLogin()
  624. Dim username,password,s
  625. username=Request.Form("username")
  626.  password=Request.Form("password")
  627.    If (Not IsEmpty(Request.Cookies("username"))) And (Not IsEmpty(Request.Cookies("password"))) Then
  628.    username=Request.Cookies("username")
  629.    password=Request.Cookies("password")
  630.    session(ZC_BLOG_CLSID&"username")=username
  631.    session(ZC_BLOG_CLSID&"password")=password
  632.    ElseIf (Not IsEmpty(session(ZC_BLOG_CLSID&"username"))) And (Not IsEmpty(session(ZC_BLOG_CLSID&"password"))) Then
  633.    username=session(ZC_BLOG_CLSID&"username")
  634.    password=session(ZC_BLOG_CLSID&"password")
  635.    Request.Cookies("username")=username
  636.    Request.Cookies("password")=password
  637.    End If
  638.    BlogUser.LoginType="Self"
  639.    BlogUser.Password=password
  640.    BlogUser.Name=username
  641.        BlogUser.Verify
  642.    
  643.    
  644.     s=BlogUser.Name&" "&ZVA_User_Level_Name(BlogUser.Level)&""
  645. If BlogUser.ID<>0 Then
  646. s=s&" <a href="""&WapLoginStr&"&amp;act=Logout&amp;url="&Escape(ZC_BLOG_HOST&ZC_FILENAME_WAP&"?mode=WAP&amp;"&Replace(Request.QueryString,"&","&amp;"))&""">"&ZC_MSG020&"</a><br/><br/>"
  647. End If
  648. WapCheckLogin=s
  649.    
  650.  End Function
  651.  Function WapCopyRight()
  652.  WapCopyRight=vbsunescape(Request.Cookies("username"))
  653.  End Function
  654.  Function WapLogout()
  655.     Response.Write WapTitle(ZC_MSG020)
  656. Response.Cookies("username")=""
  657.   Response.Cookies("password")=""
  658. session(ZC_BLOG_CLSID&"password")=""    
  659. session(ZC_BLOG_CLSID&"username")=""
  660. Response.Cookies("username")=Empty
  661.   Response.Cookies("password")=Empty
  662. session(ZC_BLOG_CLSID&"password")=Empty    
  663. session(ZC_BLOG_CLSID&"username")=Empty
  664.     Response.Write "<a href="""&unescape(Request.QueryString("url"))&""">"&ZC_MSG065&"</a><br/>"
  665.  End Function
  666.  Function ShowError_WAP(id)
  667.   Response.Redirect ZC_BLOG_HOST&ZC_FILENAME_WAP&"?act=Err&id="&id
  668.  End Function
  669. %>