📄 bbsxp_class.asp
字号:
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
On Error GoTo 0
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function DelFile(DelFilePath)
On Error Resume Next
DelFile = False
Set MyFileObject=Server.CreateOBject("Scripting.FileSystemObject")
MyFileObject.DeleteFile""&Server.MapPath(""&DelFilePath&"")&""
Set MyFileObject = Nothing
If 0 = Err or 53 = Err Then
DelFile = True
else
Alert("出错讯息:"&Err.Description&"\n"&DelFilePath&" 无法删除!")
end if
On Error GoTo 0
End Function
Function DelAttachments(SqlString)
Set Rs2=Server.CreateObject("Adodb.Recordset")
Rs2.open SqlString,Conn,1,3
do while not Rs2.eof
if ""&Rs2("FilePath")&""<>"" then IsDelFile=DelFile(""&Rs2("FilePath")&"")
if ""&Rs2("FilePath")&""="" or (""&Rs2("FilePath")&""<>"" and IsDelFile=True) then
Rs2.Delete()
Rs2.Update()
end if
Rs2.movenext
loop
Rs2.Close
set Rs2=nothing
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function CheckSize(ByteSize)
if ByteSize=>1073741824 then
ByteSize=formatnumber(ByteSize/1073741824)&" GB"
elseif ByteSize=>1048576 then
ByteSize=formatnumber(ByteSize/1048576)&" MB"
elseif ByteSize=>1024 then
ByteSize=formatnumber(ByteSize/1024)&" KB"
else
ByteSize=ByteSize&" 字节"
end if
CheckSize=ByteSize
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function UpUserRank()
Set Rs1=Execute("select top 1 RankName from ["&TablePrefix&"Ranks] where (RoleID="&Rs("UserRoleID")&" or RoleID=0) and PostingCountMin<="&Rs("TotalPosts")&" order by RoleID Desc,PostingCountMin Desc")
if Not Rs1.Eof Then UpUserRank=Rs1("RankName")
Rs1.close
Set Rs1=nothing
End Function
Function ShowRole(value)
select case value
case "1"
ShowRole="管理员"
case "2"
ShowRole="超级版主"
case "3"
ShowRole="注册用户"
case else
ShowRole=Execute("Select Name From ["&TablePrefix&"Roles] where RoleID="&value&"")(0)
end select
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function ShowUserAccountStatus(value)
select case value
case "0"
ShowUserAccountStatus="正等待审核"
case "1"
ShowUserAccountStatus="已通过审核"
case "2"
ShowUserAccountStatus="已禁用"
case "3"
ShowUserAccountStatus="未通过审核"
case else
ShowUserAccountStatus="未知状态"
end select
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function ShowUserSex(value)
if SiteConfig("AllowGender")=1 then
select case value
case 0
ShowUserSex=""
case 1
ShowUserSex="<img src=images/Sex_1.gif title='男'>"
case 2
ShowUserSex="<img src=images/Sex_2.gif title='女'>"
end select
end if
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function Zodiac(birthday)
if IsDate(birthday) then
birthyear=year(birthday)
ZodiacList=array("猴(Monkey)","鸡(Rooster)","狗(Dog)","猪(Boar)","鼠(Rat)","牛(Ox)","虎(Tiger)","兔(Rabbit)","龙(Dragon)","蛇(Snake)","马(Horse)","羊(Goat)")
Zodiac=ZodiacList(birthyear mod 12)
end if
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function Horoscope(birthday)
if IsDate(birthday) then
HoroscopeMon=month(birthday)
HoroscopeDay=day(birthday)
if Len(HoroscopeMon)<2 then HoroscopeMon="0"&HoroscopeMon
if Len(HoroscopeDay)<2 then HoroscopeDay="0"&HoroscopeDay
MyHoroscope=HoroscopeMon&HoroscopeDay
if MyHoroscope < 0120 then
Horoscope="<img src=images/Horoscope/Capricorn.gif title='魔羯座 Capricorn'>"
elseif MyHoroscope < 0219 then
Horoscope="<img src=images/Horoscope/Aquarius.gif title='水瓶座 Aquarius'>"
elseif MyHoroscope < 0321 then
Horoscope="<img src=images/Horoscope/Pisces.gif title='双鱼座 Pisces'>"
elseif MyHoroscope < 0420 then
Horoscope="<img src=images/Horoscope/Aries.gif title='白羊座 Aries'>"
elseif MyHoroscope < 0521 then
Horoscope="<img src=images/Horoscope/Taurus.gif title='金牛座 Taurus'>"
elseif MyHoroscope < 0622 then
Horoscope="<img src=images/Horoscope/Gemini.gif title='双子座 Gemini'>"
elseif MyHoroscope < 0723 then
Horoscope="<img src=images/Horoscope/Cancer.gif title='巨蟹座 Cancer'>"
elseif MyHoroscope < 0823 then
Horoscope="<img src=images/Horoscope/Leo.gif title='狮子座 Leo'>"
elseif MyHoroscope < 0923 then
Horoscope="<img src=images/Horoscope/Virgo.gif title='处女座 Virgo'>"
elseif MyHoroscope < 1024 then
Horoscope="<img src=images/Horoscope/Libra.gif title='天秤座 Libra'>"
elseif MyHoroscope < 1122 then
Horoscope="<img src=images/Horoscope/Scorpio.gif title='天蝎座 Scorpio'>"
elseif MyHoroscope < 1222 then
Horoscope="<img src=images/Horoscope/Sagittarius.gif title='射手座 Sagittarius'>"
elseif MyHoroscope > 1221 then
Horoscope="<img src=images/Horoscope/Capricorn.gif title='魔羯座 Capricorn'>"
end if
end if
End Function
Function ShowReputation(value)
if value < 4 then
ShowReputation=""
elseif value < 251 then
ShowReputation="<img src=images/ReputationA.gif title='声望:"&value&"' >"
elseif value < 10001 then
ShowReputation="<img src=images/ReputationB.gif title='声望:"&value&"' >"
elseif value > 10000 then
ShowReputation="<img src=images/ReputationC.gif title='声望:"&value&"' >"
end if
End Function
Function ShowUserActivityDay(value)
if value < 5 then
ShowUserActivityDay=""
elseif value < 32 then
ShowUserActivityDay="<img src=images/time_star.gif title='活跃天数:"&value&"' >"
elseif value < 320 then
ShowUserActivityDay ="<img src=images/time_moon.gif title='活跃天数:"&value&"' >"
elseif value > 319 then
ShowUserActivityDay ="<img src=images/time_sun.gif title='活跃天数:"&value&"' >"
end if
End Function
'针对中文日期格式的服务器
Function FormatTime(value)
FormatTime=""&FormatDateTime(value, 2)&" "&FormatDateTime(value, 4)&":"&second(value)&""
End Function
Function DefaultPasswordFormat(value)
if SiteConfig("DefaultPasswordFormat")="MD5" then
DefaultPasswordFormat=MD5(value)
Else
DefaultPasswordFormat=SHA1(value)
End if
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function ShowTags(PostID)
sql="select * from ["&TablePrefix&"PostInTags] where PostID="&PostID&""
Set Rs=Execute(sql)
do while not Rs.eof
ShowTags=ShowTags&","&Execute("Select TagName from ["&TablePrefix&"PostTags] where TagID="&Rs("TagID")&"")(0)
Rs.movenext
Loop
Rs.Close
ShowTags=Mid(ShowTags,2)
End Function
Function AddTags()
Execute("Delete from ["&TablePrefix&"PostInTags] where PostID="&PostID&"")
CookiePostTags=RequestCookies("CookiePostTags")
TempTags=","
for i=0 to Ubound(TagArray)
TempTagstr=HTMLEncode(TagArray(i))
if ""&TagArray(i)&""<>"" and instr(TempTags,","&TempTagstr&",")<=0 then
Rs.open "select top 1 * from ["&TablePrefix&"PostTags] where TagName='"&TempTagstr&"'",Conn,1,3
if Rs.eof then Rs.Addnew
Rs("TagName")=TempTagstr
Rs("MostRecentPostDate")=""&now()&""
Rs.update
TagID=Rs("TagID")
Rs.Close
Execute("insert into ["&TablePrefix&"PostInTags] (TagID,PostID) values ('"&TagID&"','"&PostID&"')")
TagsStatic(TagID)
if instr(CookiePostTags,","&TempTagstr&",")=0 then CookiePostTags=","&TempTagstr&CookiePostTags
TempTags=TempTags&TempTagstr&","
end if
next
ResponseCookies "CookiePostTags",CookiePostTags,30
End Function
Function TagsStatic(TagID)
TotalPosts=Execute("Select Count(TagID) from ["&TablePrefix&"PostInTags] where TagID="&TagID&"")(0)
Execute("Update ["&TablePrefix&"PostTags] set TotalPosts="&TotalPosts&" where TagID="&TagID&"")
TagsStatic=TotalPosts
End Function
'''''''''''''''''''''''''''''''''''''''''''
Function GroupList(ParentID)
GroupListGetRow=FetchEmploymentStatusList("Select GroupID,GroupName from ["&TablePrefix&"Groups] where SortOrder>0 order by SortOrder")
if IsArray(GroupListGetRow) then
for i=0 to Ubound(GroupListGetRow,2)
ForumsList=ForumsList&"<optgroup label='"&GroupListGetRow(1,i)&"'>"
ii=ii+1
ForumList GroupListGetRow(0,i),0,ParentID
ii=ii-1
ForumsList=ForumsList&"</optgroup>"
next
GroupList=ForumsList
End if
GroupListGetRow=null
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -