📄 topicedit.asp
字号:
<!--#include file="MarcosCB.asp"-->
<%
getConn()
isIn()
dim str,rights,theMethod,pageCode,pageTitle,pageOther
dim body,rs_tmp,boardId,boardName,theAct,replyId,topicId,boardIdList,PageFormX
str=getMainCode(mySkinId)
theAct=getPost("theAct")
boardId=getPost("boardId")
topicId=getPost("topicId")
boardName=getPost("boardName")
boardIdList=getPost("boardIdList")
replyId=replace(getPost("replyId"),"'","''")
if not(isNumeric(boardId) and isNumeric(topicId)) then
echo "错误的数据参数!"
closeConn()
response.End()
end if
if not isNumeric(replyId) and replyId<>"" then
echo "错误的数据参数!"
closeConn()
response.End()
end if
rights=canSetTrue(boardId)
if theAct="modify" then
dim topicTitle,topicContent,topicMood
dim replyTitle,replyContent,replyMood
if isNumeric(replyId) then
replyMood=getPost("mood")
replyTitle=rtrim(getPost("title"))
replyContent=rtrim(getPost("content"))
if replyContent="" then
echo "<script>alert('请填写回复内容!');history.back();</script>"
closeConn()
response.end
end if
sql="select * from Marcos_Reply where isRecycled=false and replyId="&replyId
rs.open sql,conn,1,3
if rs.eof then
echo "错误的帖子参数!(可能帖子已被删除)"
closeConn()
response.end
end if
sql="select isLocked,boardId from Marcos_Topic where topicId="&topicId
set rs_sys=conn.execute(sql)
if rs_sys.eof or rs_sys(0)=true then
echo "<script>alert('对不起,该主题已经被锁定!');history.back();</script>"
closeConn()
response.end
end if
if trim(rs("userName"))<>getValue("userName") then
canSet(rs_sys("boardId"))
end if
rs("replyTitle")=replyTitle
rs("replyContent")=replyContent
rs("replyMood")=replyMood
replyContent=replyTitle & vbnewline & replyContent
if len(replyContent)>15 then
replyContent=left(replyContent,15) & "..."
end if
rs("lastModify")="<font class=editedColor>["&getValue("userName")&"最后编辑于"&now()&"]</font>"
replyContent="回复者:@@" & getValue("userName") & "$$$回复时间:@@" & now() & "$$$回复内容:@@" & replyContent
rs("lastPostInfo")=replyContent
rs.update
rs.close
locate "topicShow.asp?boardId=" & boardId & "&boardName=" & boardName & "&topicId=" & topicId
else
topicMood=getPost("mood")
topicTitle=rtrim(getPost("title"))
topicContent=rtrim(getPost("content"))
if topicTitle="" or topicContent="" then
echo "<script>alert('请完整填写帖子标题和内容!');history.back();</script>"
closeConn()
response.end
end if
sql="select * from Marcos_Topic where isRecycled=false and isLocked=false and boardId="&boardId&" and topicId="&topicId
rs.open sql,conn,1,3
if rs.eof then
echo "错误的帖子参数!(可能帖子已被删除或者被锁定)"
closeConn()
response.end
end if
if trim(rs("userName"))<>getValue("userName") then
canSet(rs("boardId"))
end if
rs("topicMood")=topicMood
rs("topicTitle")=topicTitle
rs("topicContent")=topicContent
rs("lastModify")="<font class=editedColor>["&getValue("userName")&"最后编辑于"&now()&"]</font>"
rs.update
rs.close
if isNumeric(boardIdList) and boardIdList<>boardId then
sql="select replyCount from Marcos_Topic where topicId="&topicId
set rs_sys=conn.execute(sql)
conn.execute("update Marcos_Board set topicCount=topicCount-1,replyCount=replyCount-"&rs_sys(0)&" where boardId="&boardId)
conn.execute("update Marcos_Board set topicCount=topicCount+1,replyCount=replyCount+"&rs_sys(0)&" where boardId="&boardIdList)
conn.execute("update Marcos_Topic set boardId="&boardIdList&" where topicId="&topicId)
updatePostInfo(boardId)
updatePostInfo(boardIdList)
boardId=boardIdList
boardName=""
end if
locate "topicShow.asp?boardId=" & boardId & "&boardName=" & boardName & "&topicId=" & topicId
end if
end if
pageTitle="<a href=""topicList.asp?boardId=" & boardId & "&boardName=" & boardName & """>" & boardName & "</a> » <a href=javascript:location.reload();>编辑帖子</a>"
pageOther="<script>document.title+=' - 编辑帖子';</script>"
nowWhere "编辑帖子","javascript:;"
showHead str,pageTitle,pageOther
showBody()
showFoot(str)
sub showBody()
pageCode=getPageCode(mySkinId,"PageFormX")
PageFormX=split(pageCode,"$$$")
body=PageFormX(0)
if rights and not isNumeric(replyId) then
body=body&PageFormX(1)
sql="select boardId,boardName from Marcos_Board where topBoardId=0 order by bigOrder"
set rs_sys=conn.execute(sql)
do until rs_sys.eof
set rs_tmp=conn.execute("select boardId,boardName from Marcos_Board where topBoardId="&rs_sys(0)&" order by smallOrder")
do until rs_tmp.eof
boardIdList=boardIdList&"<option value="""&rs_tmp(0)&""" {$selected"&rs_tmp(0)&"}>"&rs_sys(1)&" - "&rs_tmp(1)&"</option>"
rs_tmp.movenext
loop
rs_sys.movenext
loop
queryTimes=queryTimes+1
body=replace(body,"{$boardIdList}",boardIdList)
body=replace(body,"{$selected"&boardId&"}","selected")
end if
if theAct="edit" then
if isNumeric(replyId) then
sql="select * from Marcos_Reply where replyId="&replyId
set rs_sys=conn.execute(sql)
theMethod="reply"
else
sql="select * from Marcos_Topic where topicId="&topicId
set rs_sys=conn.execute(sql)
theMethod="topic"
end if
end if
body=body & PageFormX(2)
body=replace(body," check","")
body=replace(body,"{$title}",rs_sys(theMethod&"Title"))
body=replace(body,"{$content}",rs_sys(theMethod&"Content"))
body=replace(body,"{$moodSelected}"," <input type=""radio"" name=""mood"" value="""&rs_sys(theMethod&"Mood")&""" checked> <img src="""&rs_sys(theMethod&"Mood")&"""><input type=hidden name=replyId value="&replyId&">")
body=replace(body,"{$formTitle}","编辑帖子")
body=replace(body,"{$theAct}","modify")
body=replace(body,"{$boardId}",boardId)
body=replace(body,"{$topicId}",topicId)
body=replace(body,"{$boardName}",boardName)
body=replace(body,"{$}","")
echo body
end sub
closeConn()
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -