📄 user_article_code.asp
字号:
FoundErr = True
ErrMsg = ErrMsg & "<li>指定的栏目不允许添加" & ChannelShortName & "</li>"
End If
If tClass("ClassType") = 2 Then
FoundErr = True
ErrMsg = ErrMsg & "<li>不能指定为外部栏目</li>"
End If
Dim CheckParentPath
If ParentID > 0 Then
CheckParentPath = ChannelDir & "all," & ParentPath & "," & ClassID
Else
CheckParentPath = ChannelDir & "all," & ClassID
End If
If CheckPurview_Class(arrClass_Input, CheckParentPath) = False Then
FoundErr = True
ErrMsg = ErrMsg & "<li>对不起,你没有此栏目的相应操作权限!</li>"
End If
End If
Set tClass = Nothing
End If
If Title = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>" & ChannelShortName & "标题不能为空</li>"
Else
Title = ReplaceText(Title, 2)
End If
If Author = "" Then Author = XmlText("BaseText", "DefAuthor", "佚名")
If CopyFrom = "" Then CopyFrom = XmlText("BaseText", "DefCopyFrom", "本站原创")
Keyword = ReplaceBadChar(Keyword)
If Keyword = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>请输入" & ChannelShortName & "关键字</li>"
Else
Call SaveKeyword(Keyword)
End If
If UseLinkUrl = "Yes" Then
If LinkUrl = "" Or LCase(LinkUrl) = "http://" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>链接地址不能为空</li>"
ElseIf Left(LCase(LinkUrl), 7) <> "http://" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>链接地址必须以 http:// 开头</li>"
End If
Else
If Content = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>" & ChannelShortName & "内容不能为空</li>"
End If
End If
Dim rsField
Set rsField = Conn.Execute("select * from PE_Field where ChannelID=" & ChannelID & " or ChannelID=-1")
Do While Not rsField.EOF
If rsField("EnableNull") = False Then
If Trim(Request(rsField("FieldName"))) = "" Then
FoundErr = True
ErrMsg = ErrMsg & "<li>请输入" & rsField("Title") & "!</li>"
End If
End If
rsField.MoveNext
Loop
If FoundErr = True Then
Exit Sub
End If
If Status < 0 Then
Status = -1
Else
If CheckLevel = 0 Or NeedlessCheck = 1 Then
Status = 3
Else
Status = 0
End If
End If
Keyword = "|" & ReplaceBadChar(Keyword) & "|"
'将绝对地址转化为相对地址
Dim strSiteUrl
strSiteUrl = Request.ServerVariables("HTTP_REFERER")
strSiteUrl = LCase(Left(strSiteUrl, InStrRev(strSiteUrl, "/") - 1))
strSiteUrl = Left(strSiteUrl, InStrRev(strSiteUrl, "/")) & ChannelDir & "/"
Content = ReplaceBadUrl(Replace(Content, strSiteUrl, "[InstallDir_ChannelDir]"))
strSiteUrl = InstallDir & ChannelDir & "/"
Content = Replace(Content, strSiteUrl, "[InstallDir_ChannelDir]")
Set rsArticle = Server.CreateObject("adodb.recordset")
If Action = "SaveAdd" Then
If Session("Title") = Title And DateDiff("S", Session("AddTime"), Now()) < 100 Then
FoundErr = True
ErrMsg = "<li>请不要重复添加同一篇文章</li>"
Exit Sub
Else
Session("Title") = Title
Session("AddTime") = Now()
If MaxPerDay > 0 Then
Set trs = Conn.Execute("select count(ArticleID) from PE_Article where Inputer='" & UserName & "' and DateDiff(" & PE_DatePart_D & ",UpdateTime," & PE_Now & ")=0")
If trs(0) >= MaxPerDay Then
FoundErr = True
ErrMsg = ErrMsg & "<li>您今天发表的" & ChannelShortName & "已经达到了上限!</li>"
End If
Set trs = Nothing
If FoundErr = True Then Exit Sub
End If
sql = "select top 1 * from PE_Article"
rsArticle.Open sql, Conn, 1, 3
rsArticle.addnew
ArticleID = PE_CLng(Conn.Execute("select max(ArticleID) from PE_Article")(0)) + 1
Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (1," & ArticleID & "," & SpecialID & ")")
rsArticle("ArticleID") = ArticleID
rsArticle("ChannelID") = ChannelID
rsArticle("ClassID") = ClassID
rsArticle("Title") = Title
rsArticle("Intro") = Intro
rsArticle("Content") = Content
rsArticle("Keyword") = Keyword
rsArticle("Hits") = 0
rsArticle("Author") = Author
rsArticle("CopyFrom") = CopyFrom
rsArticle("LinkUrl") = LinkUrl
rsArticle("Inputer") = Inputer
rsArticle("Editor") = Inputer
rsArticle("IncludePic") = IncludePic
If ShowCommentLink = "Yes" Then
rsArticle("ShowCommentLink") = True
Else
rsArticle("ShowCommentLink") = False
End If
rsArticle("Status") = Status
rsArticle("OnTop") = False
'rsArticle("Hot") = False
rsArticle("Elite") = False
rsArticle("Stars") = 0
rsArticle("UpdateTime") = Now()
rsArticle("PaginationType") = 0
rsArticle("MaxCharPerPage") = 0
rsArticle("SkinID") = 0
rsArticle("TemplateID") = 0
rsArticle("DefaultPicUrl") = DefaultPicUrl
rsArticle("UploadFiles") = UploadFiles
rsArticle("Deleted") = False
PresentExp = CLng(PresentExp * PresentExpTimes)
rsArticle("PresentExp") = PresentExp
rsArticle("InfoPoint") = DefaultItemPoint
rsArticle("VoteID") = 0
rsArticle("InfoPurview") = 0
rsArticle("arrGroupID") = ""
rsArticle("ChargeType") = DefaultItemChargeType
rsArticle("PitchTime") = DefaultItemPitchTime
rsArticle("ReadTimes") = DefaultItemReadTimes
rsArticle("DividePercent") = DefaultItemDividePercent
rsArticle("Copymoney") = 0
rsArticle("IsPayed") = False
rsArticle("Beneficiary") = UserName
If Not (rsField.BOF And rsField.EOF) Then
rsField.MoveFirst
Do While Not rsField.EOF
If Trim(Request(rsField("FieldName"))) <> "" Or rsField("EnableNull") = True Then
rsArticle(Trim(rsField("FieldName"))) = Trim(Request(rsField("FieldName")))
End If
rsField.MoveNext
Loop
End If
Set rsField = Nothing
If BlogFlag = True Then '写入BLOGID
Dim blogid
Set blogid = Conn.Execute("select top 1 ID from PE_Space where Type=1 and UserID=" & UserID)
If blogid.BOF And blogid.EOF Then
rsArticle("BlogID") = 0
Else
rsArticle("BlogID") = blogid("ID")
End If
Set blogid = Nothing
End If
rsArticle.Update
If rsArticle("Status") = 3 Then
Conn.Execute ("update PE_User set UserExp=UserExp+" & PresentExp & " where UserName='" & UserName & "'")
End If
End If
ElseIf Action = "SaveModify" Then
If ArticleID = 0 Then
FoundErr = True
ErrMsg = ErrMsg & "<li>不能确定" & ChannelShortName & "ID的值</li>"
Else
sql = "select * from PE_Article where Inputer='" & UserName & "' and Deleted=" & PE_False & " and ArticleID=" & ArticleID
rsArticle.Open sql, Conn, 1, 3
If rsArticle.BOF And rsArticle.EOF Then
FoundErr = True
ErrMsg = ErrMsg & "<li>找不到此" & ChannelShortName & ",可能已经被其他人删除。</li>"
Else
If rsArticle("Status") > 0 And EnableModifyDelete = 0 Then
FoundErr = True
ErrMsg = ErrMsg & "<li>" & ChannelShortName & "已经被审核通过,您不能再进行修改!</li>"
Else
Conn.Execute ("delete from PE_InfoS where ModuleType=1 and ItemID=" & ArticleID)
Conn.Execute ("insert into PE_InfoS (ModuleType,ItemID,SpecialID) values (1," & ArticleID & "," & SpecialID & ")")
rsArticle("ClassID") = ClassID
rsArticle("Title") = Title
rsArticle("Intro") = Intro
rsArticle("Content") = Content
rsArticle("Keyword") = Keyword
rsArticle("Author") = Author
rsArticle("CopyFrom") = CopyFrom
rsArticle("LinkUrl") = LinkUrl
rsArticle("IncludePic") = IncludePic
rsArticle("Status") = Status
If ShowCommentLink = "Yes" Then
rsArticle("ShowCommentLink") = True
Else
rsArticle("ShowCommentLink") = False
End If
rsArticle("UpdateTime") = Now()
rsArticle("DefaultPicUrl") = DefaultPicUrl
rsArticle("UploadFiles") = UploadFiles
If Not (rsField.BOF And rsField.EOF) Then
rsField.MoveFirst
Do While Not rsField.EOF
If Trim(Request(rsField("FieldName"))) <> "" Or rsField("EnableNull") = True Then
rsArticle(Trim(rsField("FieldName"))) = PE_HTMLEncode(Trim(Request(rsField("FieldName"))))
End If
rsField.MoveNext
Loop
End If
Set rsField = Nothing
rs
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -