📄 bloginterface.asp
字号:
Tags = ""
End If
If StrLength(Abstract) > 500 Then'摘要大于500字符置0
Abstract = ""
End If
If (Abstract <> "") Then
Abstract = oblog.filt_html(Abstract)
End If
Dim rs
Set rs = Server.CreateObject("adodb.recordset")
rs.open "select TOP 1 * FROM [oblog_log] where Userid="&Userid&" ORDER BY logid desc", conn, 2, 2
If (Not rs.bof) And (Not rs.eof) Then
'判断是否超出允许发布的时间间隔
Dim timeDiff
'先判断是否超过一天
timeDiff = DateDiff("d", rs("truetime"), Now())
If timeDiff = 0 Then'当日内
timeDiff = DateDiff("s", rs("truetime"), Now())
If ((timeDiff < MAX_PUBLISHSPACE_TIME) And (MAX_PUBLISHSPACE_TIME <> 0)) Then
rs.Close
Set rs = Nothing
Call ResponseError(ERROR_NOT_LEGAL_PUBLISHSPACE_TIME)
End If
End If
End If
rs.AddNew
rs("topic") = Topic
rs("logtext") = Log_Text
rs("face") = Face
rs("addtime") = AddTime
rs("classid") = Classid
rs("subjectid") = Subjectid
rs("authorid") = AuthorId
rs("author") = Author
rs("userid") = Userid
rs("ishide") = IsHide
rs("istop") = IsTop
rs("tburl") = TbUrl
rs("logtype") = LogType
rs("isencomment") = IsEncomment
rs("abstract") = Abstract
rs("ispassword") = IsPassword
rs("passcheck") = PassCheck
rs("isdraft") = IsDraft
rs("iis") = Iis
rs("commentnum") = CommentNum
rs("trackbacknum") = TrackbackNum
rs("blog_password") = Blog_Password
rs("truetime") = TrueTime
'增加积分
Call oblog.GiveScore("",oblog.cacheScores(3),"")
rs("scores")=oblog.cacheScores(3)
rs.Update
rs.Close
Set rs = conn.execute("select max(logid) from oblog_log where userid="&userid)
Id = rs(0)
If (Tags <> "") Then
Call Tags_UserAdd(Tags, Userid, Id)
End If
conn.Execute("UPDATE [oblog_user] SET [log_count] = [log_count] + 1 WHERE [userid] = "&AuthorId)
If (Subjectid > 0) Then
conn.Execute("UPDATE [oblog_subject] SET [subjectlognum] = [subjectlognum] + 1 WHERE [subjectid] = "&Subjectid)
End If
If (Classid > 0) Then
conn.Execute("UPDATE [oblog_logclass] SET [classlognum] = [classlognum] + 1 WHERE [classid] = "&Classid)
End If
conn.Execute("UPDATE [oblog_setup] SET [log_count] = log_count + 1")
Dim blog
Set blog = New class_blog
blog.userid=Userid
If (TrackBack <> "") Then
Dim objTrackBack
Set objTrackBack=New Class_TrackBack
objTrackBack.Logid=Id
objTrackBack.Blog_Name=blog.BlogName
objTrackBack.Title=Topic
objTrackBack.URL=oblog.setup(3,0) & "go.asp?logid=" &Id
objTrackBack.Excerpt=Topic & "<br />oBlog Created"
Call objTrackBack.ProcessMultiPing(TrackBack)
Set objTrackBack =Nothing
End If
blog.update_log id,0
blog.update_calendar(id)
blog.update_newblog(Userid)
blog.update_subject(Userid)
blog.update_info(Userid)
set blog=nothing
Set rs = Nothing
AddNew = True
End Function
Public Function VerifyId(log_ID)
VerifyId = False
'Call CheckParameter(log_ID,"Int",0)
Dim rs
Set rs = conn.Execute("select [logid] FROM [oblog_log] WHERE [logid]=" & CLng(log_ID)&" and userid="&objUser.id)
If (Not rs.bof) And (Not rs.eof) Then
Id = rs("logid")
Else
VerifyId = False
End If
rs.Close
Set rs = Nothing
VerifyId = True
End Function
Public Function LoadInfobyID(log_ID)
'Call CheckParameter(log_ID,"Int",0)
Dim rs
Set rs = conn.Execute("select * FROM [oblog_log] WHERE [logid]=" & CLng(log_ID)&" and userid="&objUser.id)
If (Not rs.bof) And (Not rs.eof) Then
Id = rs("logid")
SubjectId = rs("subjectid")
Topic = rs("topic")
Log_Text = rs("logtext")
AuthorId = rs("authorid")
AddTime = rs("addtime")
CommentNum = rs("commentnum")
TrackbackNum= rs("trackbacknum")
Author = rs("author")
Else
Exit Function
End If
rs.Close
Set rs=Nothing
LoadInfobyID=True
End Function
Public Function Modify()
Modify = False
'If ClassId="" then ClassId = 0 End If
If SubjectId = "" then SubjectId = 0 End If
Dim rs, oldSubjectId
Set rs = conn.Execute("select [subjectid] FROM [oblog_log] WHERE [logid] = " & CLng(Id)&" and userid="&objUser.id)
oldSubjectId = rs("subjectid")
rs.Close
Set rs = Nothing
If (Subjectid > 0) And (Subjectid <> oldSubjectid) Then
conn.Execute("UPDATE [oblog_subject] SET [subjectlognum] = subjectlognum + 1 WHERE [subjectid] = "&Subjectid)
conn.Execute("UPDATE [oblog_subject] SET [subjectlognum] = subjectlognum - 1 WHERE [subjectid] = "&oldSubjectid)
End If
conn.Execute("UPDATE [oblog_log] SET [topic]='"&Topic&"',[logtext]='"&Log_Text&"',[truetime]='"&Now()&"',[subjectid]="&SubjectId&" WHERE [logid] =" & Id &" and userid="&objUser.id)
Modify = True
End Function
Public Function Delete()
deloneblog(Id)
Delete = True
End Function
Public Function StrLength(Str)
Dim WINNT_CHINESE
WINNT_CHINESE = (Len("中国") = 2)
If WINNT_CHINESE Then
Dim l, t, c
Dim i
l = Len(Str)
t = l
For i = 1 To l
c = Asc(Mid(Str, i, 1))
If c < 0 Then c = c + 65536
If c > 255 Then
t = t + 1
End If
Next
StrLength = t
Else
StrLength = Len(Str)
End If
End Function
End Class
Class BlogUpLoadFile
Public ID
Public AuthorID
Public FileSize
Public FileName
Public PostTime
Public Stream
Public BackUrl
Private FUploadType
Public Property Let UploadType(strUploadType)
If (strUploadType="Stream") Then
FUploadType=strUploadType
Else
FUploadType="Form"
End If
End Property
Public Property Get UploadType
If IsEmpty(FUploadType)=True Then
UploadType="Form"
Else
UploadType = FUploadType
End If
End Property
Private Function UpLoad_Stream()
FileSize=LenB(Stream)
End Function
Public Function UpLoad()
UpLoad = FALSE
Dim enupload, upfiletype, onesize, maxsize, freesize,FileExt
If UploadType="Form" Then
'Call UpLoad_Form()
ElseIf UploadType="Stream" Then
Call UpLoad_Stream()
End If
If oblog.l_Group(24,0)=-1 Then
enupload=0
Else
enupload=1
End If
upfiletype=oblog.l_Group(22,0)
'Response.Write upfiletype
'Response.End
onesize=oblog.l_Group(23,0)
maxsize=oblog.l_Group(24,0)
'当前系统设置不允许上传文件
If enupload = 0 Then
ResponseError(ERROR_FORBID_UPLOADFILE)
Exit Function
End If
'上传空间已满,不允许上传文件,请整理上传文档
'If objUser.UserUpMax > 0 Then maxsize = objUser.UserUP
freesize = Int(maxsize - oblog.l_uUpUsed / 1024)
If freesize <= 0 Then
ResponseError(ERROR_NOSPACE_FOR_UPLOADFILE)
Exit Function
End if
FileName=FilterSQL(FileName)
Dim filePath
If upload_dir <> "" Then
filePath = upload_dir
Else
filePath = oblog.l_udir&"/"&oblog.l_ufolder&"/upload"
End If
filePath = CreatePath(filePath)
Randomize
FileExt=Lcase(Mid(FileName,InStrRev(FileName, ".")+1))
if not CheckFileExt(FileExt,upfiletype) then
ResponseError(ERROR_NOSPACE_FOR_UPLOADFILE_2)
Exit Function
end if
FileExt=FixName(FileExt)
FileName = Year(Now) & Right("0"&Month(Now),2) & Right("0"&Day(Now),2) & Right("0"&Hour(Now),2) & Right("0"&Minute(Now),2) & Right("0"&Second(Now),2) & Int(9 * Rnd) & Int(9 * Rnd) & Int(9 * Rnd) & Int(9 * Rnd) &"."& FileExt
Dim objStreamFile
Set objStreamFile = Server.CreateObject(oblog.CacheCompont(2))
objStreamFile.Type = 1
objStreamFile.Mode = 3
objStreamFile.Open
objStreamFile.Write Stream
if objStreamFile.size/1024>freesize then
objStreamFile.Close
ResponseError(ERROR_NOSPACE_FOR_UPLOADFILE)
Exit Function
elseif objStreamFile.size/1024>onesize then
objStreamFile.Close
ResponseError(ERROR_SHUTDOWN_UPLOADFILE_1)
Exit Function
else
objStreamFile.SaveToFile Server.MapPath(filePath) & "\" & FileName,2
end if
objStreamFile.Close
Dim rs
'If instr("jpg,gif,bmp,pcx,png,psd",fileExt) = 0 Then isphoto = 0
conn.execute("UPDATE [oblog_user] SET [user_upfiles_size] = user_upfiles_size + "&FileSize&" WHERE [userid] = "&AuthorId)
Set rs = Server.CreateObject("adodb.recordset")
rs.open "select TOP 1 * FROM [oblog_upfile]", conn, 2, 2
rs.AddNew
rs("userid") = AuthorId
rs("file_name") = FileName
rs("file_path") = Mid(filePath, 4) & FileName
rs("file_ext") = fileExt
rs("file_size") = FileSize
rs("isphoto") = 0
rs.Update
rs.Update
rs.close
Set rs = Nothing
BackUrl = oblog.cacheconfig(3) & Mid(filePath, 4) & FileName
UpLoad = True
End Function
'检查上传目录,若无目录则自动建立
Public Function CreatePath(PathValue)
Dim objFSO,Fsofolder,uploadpath
If upload_dir<>"" Then
uploadpath = year(Date) & "-" & month(Date)
Else
uploadpath=""
End If
If Right(PathValue,1)<>"/" Then PathValue = PathValue&"/"
Set objFSO = Server.CreateObject(oblog.CacheCompont(1))
If objFSO.FolderExists(Server.MapPath("../" & PathValue & uploadpath))=False Then
objFSO.CreateFolder Server.MapPath("../" & PathValue & uploadpath)
End If
If upload_dir<>"" Then
CreatePath = "../" & PathValue & uploadpath & "/"
Else
CreatePath = "../" & PathValue
End If
Set objFSO = Nothing
End Function
Private Function CheckFileExt(FileExt,upfiletype)
Dim Forumupload,i
CheckFileExt=False
If FileExt="" or IsEmpty(FileExt) Then
CheckFileExt = False
Exit Function
End If
select Case LCase(FileExt)
Case "asp","asa","aspx","shtm","shtml","php","php3","jsp"
CheckFileExt = False
Exit Function
Case else
End select
Forumupload = Split(upfiletype,"|")
For i = 0 To ubound(Forumupload)
If FileExt = Trim(Forumupload(i)) Then
CheckFileExt = True
Exit Function
Else
CheckFileExt = False
End If
Next
End Function
Private Function FixName(Byval UpFileExt)
If IsEmpty(UpFileExt) Then Exit Function
FixName = Lcase(UpFileExt)
FixName = Replace(FixName,Chr(0),"")
FixName = Replace(FixName,".","")
FixName = Replace(FixName,"'","")
FixName = Replace(FixName,"asp","_")
FixName = Replace(FixName,"asa","_")
FixName = Replace(FixName,"aspx","_")
FixName = Replace(FixName,"cer","_")
FixName = Replace(FixName,"cdx","_")
FixName = Replace(FixName,"htr","_")
FixName = Replace(FixName,"shtm","_")
FixName = Replace(FixName,"shtml","_")
FixName = Replace(FixName,"php","_")
FixName = Replace(FixName,"php3","_")
FixName = Replace(FixName,"jsp","_")
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -