%
Dim Rs, SQL,i,guestid
Dim Facestr,FaceOption,FormatInput,strEmotion
Newasp.LoadTemplates 9999, 3, 0
HtmlContent = Newasp.HtmlContent
HtmlContent = Replace(HtmlContent,"{$GuestFormContent}", Newasp.HtmlSetting(10))
HtmlContent = Replace(HtmlContent,"{$InstallDir}", Newasp.InstallDir)
HtmlContent = Replace(HtmlContent, "{$ChannelID}", ChannelID)
'--频道目录
HtmlContent = Replace(HtmlContent,"{$ChannelRootDir}", ChannelRootDir, 1, -1, 1)
HtmlContent = Replace(HtmlContent,"{$CurrentStation}",Newasp.ChannelName)
HtmlContent = Replace(HtmlContent,"{$PageTitle}","编辑留言")
HtmlContent = Replace(HtmlContent,"{$IndexTitle}",strIndexName)
HtmlContent = ReadClassMenu(HtmlContent)
HtmlContent = ReadClassMenubar(HtmlContent)
HtmlContent = HTML.ReadAnnounceList(HtmlContent)
HtmlContent = HTML.ReadStatistic(HtmlContent)
HtmlContent = HTML.ReadUserRank(HtmlContent)
HtmlContent = Replace(HtmlContent, "{$MemberName}", Newasp.membername)
HtmlContent = Replace(HtmlContent,"{$LeastString}", Newasp.LeastString)
HtmlContent = Replace(HtmlContent, "{$MaxString}", Newasp.MaxString)
guestid = Newasp.ChkNumeric(Request("guestid"))
If guestid = 0 Then
Response.Write"错误的系统参数!"
Response.End
End If
HtmlContent = Replace(HtmlContent, "{$GuestID}", guestid)
HtmlContent = Replace(HtmlContent,"{$Action}","save")
HtmlContent = Replace(HtmlContent,"{$SubmitValue}","编辑留言")
If CInt(Newasp.membergrade) = 999 Or Trim(Session("AdminName")) <> "" Then
If Newasp.CheckStr(LCase(Request.Form("action"))) = "save" And Request.Form("action") <> "" Then
Call SaveGuestBook
Else
Call EditGuestBook
End If
Else
Call OutAlertScript(Newasp.HtmlSetting(3))
End If
Sub EditGuestBook()
Set Rs = Newasp.Execute("SELECT * FROM NC_GuestBook WHERE guestid ="& guestid)
If Rs.BOF And Rs.EOF Then
Set Rs = Nothing
Call OutAlertScript("错误的系统参数!")
End If
HtmlContent = Replace(HtmlContent,"{$GuestTopic}",Newasp.CheckTopic(Rs("title")))
HtmlContent = Replace(HtmlContent,"{$UserName}",Newasp.CheckTopic(Rs("username")))
HtmlContent = Replace(HtmlContent,"{$GuestEmail}",Newasp.CheckTopic(Rs("GuestEmail")))
HtmlContent = Replace(HtmlContent,"{$GuestQQ}",Newasp.CheckTopic(Rs("GuestOicq")))
HtmlContent = Replace(HtmlContent,"{$HomePage}",Newasp.CheckTopic(Rs("HomePage")))
HtmlContent = Replace(HtmlContent,"{$SelectOption}","")
FaceOption = ""
For i=1 to 20
FaceOption = FaceOption & ""
Next
HtmlContent = Replace(HtmlContent, "{$FaceOption}", FaceOption)
FormatInput = "设置标题样式 ABCdef"
FormatInput = FormatInput & " 取消格式"
HtmlContent = Replace(HtmlContent,"{$FormatInput}",FormatInput)
HtmlContent = Replace(HtmlContent,"{$Topicformat}",Newasp.CheckTopic(Rs("Topicformat")))
strEmotion = "
"
For i = 2 To 26
If i = 14 then strEmotion = strEmotion & "
"
strEmotion = strEmotion & "
"
Next
HtmlContent = Replace(HtmlContent,"{$EmotionInput}",strEmotion)
HtmlContent = Replace(HtmlContent,"{$GuestContent}",Server.HTMLEncode(Rs("content")))
If Rs("isAdmin") <> 0 Then
HtmlContent = Replace(HtmlContent,"{$IsAdminChecked}"," checked")
Else
HtmlContent = Replace(HtmlContent,"{$IsAdminChecked}","")
End If
If Rs("ForbidReply") <> 0 Then
HtmlContent = Replace(HtmlContent,"{$ForbidChecked}"," checked")
Else
HtmlContent = Replace(HtmlContent,"{$ForbidChecked}","")
End If
If Rs("isTop") <> 0 Then
HtmlContent = Replace(HtmlContent,"{$IsTopChecked}"," checked")
Else
HtmlContent = Replace(HtmlContent,"{$IsTopChecked}","")
End If
If CInt(Rs("isAccept")) = 0 Then
HtmlContent = Replace(HtmlContent,"{$IsAcceptChecked}","")
Else
HtmlContent = Replace(HtmlContent,"{$IsAcceptChecked}"," checked")
End If
'-- 编辑器设置
Dim oEditor,EditorCode
Set oEditor = New Editor_Cls
oEditor.UserMode = 1
oEditor.setEditMode = Newasp.setUserEditor(0)
oEditor.ChannelID = ChannelID
oEditor.Width = Newasp.setUserEditor(2)
oEditor.Height = Newasp.setUserEditor(3)
oEditor.BasePath = Newasp.InstallDir & Newasp.setAdminEditor(4)
oEditor.ToolbarSet = Newasp.setUserEditor(1)'Default,AdminMode,Simple,UserMode,Basic
oEditor.Value = Rs("Content")
oEditor.InstanceName = "content"
EditorCode = oEditor.CreateEditor()
Set oEditor = Nothing
HtmlContent = Replace(HtmlContent, "{$EditorCode}", EditorCode)
Response.Write HtmlContent
Rs.Close:Set Rs = Nothing
End Sub
Sub SaveGuestBook()
On Error Resume Next
Dim TextContent,ChkPostData
If Trim(Request.Form("username")) = "" Then
ErrMsg = ErrMsg + "用户名不能为空\n"
Founderr = True
End If
If Not Newasp.CodeIsTrue() Then
ErrMsg = ErrMsg + "验证码校验失败,请返回刷新页面再试。两秒后自动返回\n"
Founderr = True
End If
Session("GetCode") = ""
If Newasp.IsValidStr(Request.Form("username")) = False Then
ErrMsg = ErrMsg + "用户名中含有非法字符\n"
Founderr = True
End If
If Trim(Request.Form("GuestEmail")) = "" Then
ErrMsg = ErrMsg + "用户邮箱不能为空\n"
Founderr = True
End If
If Not IsValidEmail(Request.Form("GuestEmail")) Then
ErrMsg = ErrMsg + "请正确填写您的邮箱\n"
Founderr = True
End If
If Trim(Request.Form("topic")) = "" Then
ErrMsg = ErrMsg + "留言主题不能为空\n"
Founderr = True
End If
If Trim(Request.Form("content")) = "" Then
ErrMsg = ErrMsg + "留言内容不能为空\n"
Founderr = True
End If
If Len(Request.Form("content")) < Newasp.LeastString Then
ErrMsg = ErrMsg + ("留言内容不能小于" & Newasp.LeastString & "字符!")
Founderr = True
End If
If Len(Request.Form("content")) > Newasp.MaxString Then
ErrMsg = ErrMsg + ("留言内容不能大于" & Newasp.MaxString & "字符!")
Founderr = True
End If
TextContent = Request.Form("content")
If Newasp.setUserEditor(0) <> 0 Then
TextContent = Newasp.HTMLEncodes(TextContent)
End If
ChkPostData = Newasp.NeedIsAudit(TextContent,Request.Form("topic") & " " & Request.Form("username"))
If ChkPostData > 0 Then
ErrMsg = "请不要发表含有不适当内容的留言,请不要发表广告信息"
Founderr = True
End If
If Founderr = True Then
Call OutAlertScript(ErrMsg)
Exit Sub
End If
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM NC_GuestBook WHERE guestid="& guestid
Rs.Open SQL,Conn,1,3
Rs("Topicformat") = Newasp.CheckStr(Request.Form("Topicformat"))
Rs("title") = Newasp.ChkFormStr(Left(Request.Form("topic"),100))
Rs("content") = Trim(TextContent)
Rs("username") = Left(Request.Form("username"),50)
Rs("face") = Trim(Request.Form("face"))
Rs("emot") = Trim(Request.Form("emot"))
Rs("HomePage") = Newasp.CheckStr(Left(Request.Form("HomePage"),100))
Rs("GuestEmail") = Newasp.CheckStr(Trim(Request.Form("GuestEmail")))
Rs("GuestOicq") = Newasp.CheckStr(Left(Request.Form("GuestOicq"),30))
Rs("ComeFrom") = Trim(Request.Form("ComeFrom"))
Rs("isAdmin") = Newasp.ChkNumeric(Request.Form("isAdmin"))
Rs("isTop") = Newasp.ChkNumeric(Request.Form("isTop"))
Rs("isAccept") = Newasp.ChkNumeric(Request.Form("isAccept"))
Rs("ForbidReply") = Newasp.ChkNumeric(Request.Form("ForbidReply"))
Rs.update
Rs.Close:Set Rs = Nothing
Call OutputScript(Newasp.HtmlSetting(4),"index.asp")
End Sub
Set HTML = Nothing
CloseConn
%>