<%@ LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% '***************PJblog2 基本设置******************* ' PJblog2 Copyright 2005 ' Update:2005-8-16 '************************************************** Option Explicit Response.Buffer = True Server.ScriptTimeOut = 90 Session.CodePage = 65001 Session.LCID = 2057 '定义 Cookie,Application 域,必须修改,否则可能运行不正常 '把"PJBlog3"和"PJBlog3Setting"引号里面的东西替换称任意英文数值值即可 Const CookieName = "PJBlog3" Const CookieNameSetting = "PJBlog3Setting" Const IPViewURL = "http://www.dheart.net/ip/index.php?ip=" 'IP查询网站地址 Response.Cookies(CookieNameSetting).Expires = Date+365 Response.Cookies(CookieName).path = "/" '站点开关操作 If Not IsNumeric(Application(CookieName & "_SiteEnable")) Or IsEmpty(Application(CookieName & "_SiteEnable")) Then Application.Lock Application(CookieName & "_SiteEnable") = 1 Application(CookieName & "_SiteDisbleWhy") = "" Application.UnLock End If If Application(CookieName & "_SiteEnable") = 0 And Application(CookieName & "_SiteDisbleWhy")<>"" And InStr(Replace(LCase(Request.ServerVariables("URL")), "\", "/"), "/control.asp") = 0 And InStr(Replace(LCase(Request.ServerVariables("URL")), "\", "/"), "/login.asp") = 0 And InStr(Replace(LCase(Request.ServerVariables("URL")), "\", "/"), "/conmenu.asp") = 0 And InStr(Replace(LCase(Request.ServerVariables("URL")), "\", "/"), "/conhead.asp") = 0 And InStr(Replace(LCase(Request.ServerVariables("URL")), "\", "/"), "/concontent.asp") = 0 Then Response.Write("
" Then
ts = ts + 1
End If
If ts>ContentNums Then Exit For
Next
If ts>ContentNums Then
Content = Left(Content, i -1)
End If
SplitLines = Content
End Function
'*************************************
'切割内容 - 按字符分割
'*************************************
Function CutStr(byVal Str, byVal StrLen)
Dim l, t, c, i
If IsNull(Str) Then
CutStr = ""
Exit Function
End If
l = Len(Str)
StrLen = Int(StrLen)
t = 0
For i = 1 To l
c = Asc(Mid(Str, i, 1))
If c<0 Or c>255 Then t = t + 2 Else t = t + 1
If t>= StrLen Then
CutStr = Left(Str, i)&"..."
Exit For
Else
CutStr = Str
End If
Next
End Function
'*************************************
'Trackback Function
'*************************************
Function Trackback(trackback_url, url, title, excerpt, blog_name)
Dim query_string, objXMLHTTP
query_string = "title="&cutStr(Server.URLEncode(title), 100)&"&url="&Server.URLEncode(url)&"&blog_name="&Server.URLEncode(blog_name)&"&excerpt="&cutStr(Server.URLEncode(excerpt), 252)
Set objXMLHTTP = Server.CreateObject(getXMLHTTP())
objXMLHTTP.Open "POST", trackback_url, False
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-Form-urlencoded"
'HAndling timeout
On Error Resume Next
objXMLHTTP.Send query_string
Err.Clear
Set objXMLHTTP = Nothing
End Function
'*************************************
'删除引用标签
'*************************************
Function DelQuote(strContent)
If IsNull(strContent) Then Exit Function
Dim re, iarray, i
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
iarray = Array("quote","reply", "img", "swf|wma|wmv|rm|ra|qt", "mid", "url", "ed2k", "email", "align", "color", "size", "font", "b", "i", "u", "s", "sup", "sub", "fly", "down", "mDown", "cc", "code", "hidden", "html")
for i = 0 to UBound(iarray)
re.Pattern = "\[quote\](.[^\]]*?)\[\/quote\]"
strContent = re.Replace(strContent, "")
re.Pattern = "\[quote=(.[^\]]*)\](.[^\]]*?)\[\/quote\]"
strContent = re.Replace(strContent, "")
re.Pattern = "\[reply=(.[^\]]*),(.[^\]]*)\](.*?)\[\/reply\]"
strContent = re.Replace(strContent, "")
re.Pattern = "\[reply=(.[^\]]*)\](.[^\]]*?)\[\/reply\]"
strContent = re.Replace(strContent, "")
re.Pattern = "\["&iarray(i)&"\]"
strContent = re.Replace(strContent, "")
re.Pattern = "\["&iarray(i)&"=(.[^\]]*)\]"
strContent = re.Replace(strContent, "")
re.Pattern = "\[\/"&iarray(i)&"\]"
strContent = re.Replace(strContent, "")
re.Pattern = "\[\/"&iarray(i)&"=(.[^\]]*)\]"
strContent = re.Replace(strContent, "")
next
Dim log_Smilies, log_SmiliesContent
For Each log_Smilies IN Arr_Smilies
log_SmiliesContent = Split(log_Smilies, "|")
strContent = Replace(strContent, log_SmiliesContent(2), "")
Next
Set re = Nothing
DelQuote = strContent
End Function
'*************************************
'获取客户端IP
'*************************************
Function getIP()
Dim strIP, IP_Ary, strIP_list
strIP_list = Replace(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "'", "")
If InStr(strIP_list, ",")<>0 Then
IP_Ary = Split(strIP_list, ",")
strIP = IP_Ary(0)
Else
strIP = strIP_list
End If
If strIP = Empty Then strIP = Replace(Request.ServerVariables("REMOTE_ADDR"), "'", "")
getIP = strIP
End Function
'*************************************
'获取客户端浏览器信息
'*************************************
Function getBrowser(strUA)
Dim arrInfo, strType, temp1, temp2
strType = ""
strUA = LCase(strUA)
arrInfo = Array("Unkown", "Unkown")
'浏览器判断
If InStr(strUA, "mozilla")>0 Then arrInfo(0) = "Mozilla"
If InStr(strUA, "icab")>0 Then arrInfo(0) = "iCab"
If InStr(strUA, "lynx")>0 Then arrInfo(0) = "Lynx"
If InStr(strUA, "links")>0 Then arrInfo(0) = "Links"
If InStr(strUA, "elinks")>0 Then arrInfo(0) = "ELinks"
If InStr(strUA, "jbrowser")>0 Then arrInfo(0) = "JBrowser"
If InStr(strUA, "konqueror")>0 Then arrInfo(0) = "konqueror"
If InStr(strUA, "wget")>0 Then arrInfo(0) = "wget"
If InStr(strUA, "ask jeeves")>0 Or InStr(strUA, "teoma")>0 Then arrInfo(0) = "Ask Jeeves/Teoma"
If InStr(strUA, "wget")>0 Then arrInfo(0) = "wget"
If InStr(strUA, "opera")>0 Then arrInfo(0) = "opera"
If InStr(strUA, "gecko")>0 Then
strType = "[Gecko]"
arrInfo(0) = "Mozilla"
If InStr(strUA, "aol")>0 Then arrInfo(0) = "AOL"
If InStr(strUA, "netscape")>0 Then arrInfo(0) = "Netscape"
If InStr(strUA, "firefox")>0 Then arrInfo(0) = "FireFox"
If InStr(strUA, "chimera")>0 Then arrInfo(0) = "Chimera"
If InStr(strUA, "camino")>0 Then arrInfo(0) = "Camino"
If InStr(strUA, "galeon")>0 Then arrInfo(0) = "Galeon"
If InStr(strUA, "k-meleon")>0 Then arrInfo(0) = "K-Meleon"
arrInfo(0) = arrInfo(0) + strType
End If
If InStr(strUA, "bot")>0 Or InStr(strUA, "crawl")>0 Then
strType = "[Bot/Crawler]"
arrInfo(0) = ""
If InStr(strUA, "grub")>0 Then arrInfo(0) = "Grub"
If InStr(strUA, "googlebot")>0 Then arrInfo(0) = "GoogleBot"
If InStr(strUA, "msnbot")>0 Then arrInfo(0) = "MSN Bot"
If InStr(strUA, "slurp")>0 Then arrInfo(0) = "Yahoo! Slurp"
arrInfo(0) = arrInfo(0) + strType
End If
If InStr(strUA, "applewebkit")>0 Then
strType = "[AppleWebKit]"
arrInfo(0) = ""
If InStr(strUA, "omniweb")>0 Then arrInfo(0) = "OmniWeb"
If InStr(strUA, "safari")>0 Then arrInfo(0) = "Safari"
arrInfo(0) = arrInfo(0) + strType
End If
If InStr(strUA, "msie")>0 Then
strType = "[MSIE"
temp1 = Mid(strUA, (InStr(strUA, "msie") + 4), 6)
temp2 = InStr(temp1, ";")
temp1 = Left(temp1, temp2 -1)
strType = strType & temp1 &"]"
arrInfo(0) = "Internet Explorer"
If InStr(strUA, "msn")>0 Then arrInfo(0) = "MSN"
If InStr(strUA, "aol")>0 Then arrInfo(0) = "AOL"
If InStr(strUA, "webtv")>0 Then arrInfo(0) = "WebTV"
If InStr(strUA, "myie2")>0 Then arrInfo(0) = "MyIE2"
If InStr(strUA, "maxthon")>0 Then arrInfo(0) = "Maxthon"
If InStr(strUA, "gosurf")>0 Then arrInfo(0) = "GoSurf"
If InStr(strUA, "netcaptor")>0 Then arrInfo(0) = "NetCaptor"
If InStr(strUA, "sleipnir")>0 Then arrInfo(0) = "Sleipnir"
If InStr(strUA, "avant browser")>0 Then arrInfo(0) = "AvantBrowser"
If InStr(strUA, "greenbrowser")>0 Then arrInfo(0) = "GreenBrowser"
If InStr(strUA, "slimbrowser")>0 Then arrInfo(0) = "SlimBrowser"
arrInfo(0) = arrInfo(0) + strType
End If
'操作系统判断
If InStr(strUA, "windows")>0 Then arrInfo(1) = "Windows"
If InStr(strUA, "windows ce")>0 Then arrInfo(1) = "Windows CE"
If InStr(strUA, "windows 95")>0 Then arrInfo(1) = "Windows 95"
If InStr(strUA, "win98")>0 Then arrInfo(1) = "Windows 98"
If InStr(strUA, "windows 98")>0 Then arrInfo(1) = "Windows 98"
If InStr(strUA, "windows 2000")>0 Then arrInfo(1) = "Windows 2000"
If InStr(strUA, "windows xp")>0 Then arrInfo(1) = "Windows XP"
If InStr(strUA, "windows nt")>0 Then
arrInfo(1) = "Windows NT"
If InStr(strUA, "windows nt 5.0")>0 Then arrInfo(1) = "Windows 2000"
If InStr(strUA, "windows nt 5.1")>0 Then arrInfo(1) = "Windows XP"
If InStr(strUA, "windows nt 5.2")>0 Then arrInfo(1) = "Windows 2003"
End If
If InStr(strUA, "x11")>0 Or InStr(strUA, "unix")>0 Then arrInfo(1) = "Unix"
If InStr(strUA, "sunos")>0 Or InStr(strUA, "sun os")>0 Then arrInfo(1) = "SUN OS"
If InStr(strUA, "powerpc")>0 Or InStr(strUA, "ppc")>0 Then arrInfo(1) = "PowerPC"
If InStr(strUA, "macintosh")>0 Then arrInfo(1) = "Mac"
If InStr(strUA, "mac osx")>0 Then arrInfo(1) = "MacOSX"
If InStr(strUA, "freebsd")>0 Then arrInfo(1) = "FreeBSD"
If InStr(strUA, "linux")>0 Then arrInfo(1) = "Linux"
If InStr(strUA, "palmsource")>0 Or InStr(strUA, "palmos")>0 Then arrInfo(1) = "PalmOS"
If InStr(strUA, "wap ")>0 Then arrInfo(1) = "WAP"
'arrInfo(0)=strUA
getBrowser = arrInfo
End Function
'*************************************
'计算随机数
'*************************************
Function randomStr(intLength)
Dim strSeed, seedLength, pos, Str, i
strSeed = "abcdefghijklmnopqrstuvwxyz1234567890"
seedLength = Len(strSeed)
Str = ""
Randomize
For i = 1 To intLength
Str = Str + Mid(strSeed, Int(seedLength * Rnd) + 1, 1)
Next
randomStr = Str
End Function
'*************************************
'自动闭合UBB
'*************************************
Function closeUBB(strContent)
Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
arrTags = Array("code", "quote", "list", "color", "align", "font", "size", "b", "i", "u", "s", "html")
For i = 0 To UBound(arrTags)
OpenPos = 0
ClosePos = 0
re.Pattern = "\[" + arrTags(i) + "(=[^\[\]]+|)\]"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
OpenPos = OpenPos + 1
Next
re.Pattern = "\[/" + arrTags(i) + "\]"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
ClosePos = ClosePos + 1
Next
For j = 1 To OpenPos - ClosePos
strContent = strContent + "[/" + arrTags(i) + "]"
Next
Next
closeUBB = strContent
End Function
'*************************************
'自动闭合HTML
'*************************************
Function closeHTML(strContent)
Dim arrTags, i, OpenPos, ClosePos, re, strMatchs, j, Match
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
arrTags = Array("p", "div", "span", "table", "ul", "font", "b", "u", "i", "h1", "h2", "h3", "h4", "h5", "h6")
For i = 0 To UBound(arrTags)
OpenPos = 0
ClosePos = 0
re.Pattern = "\<" + arrTags(i) + "( [^\<\>]+|)\>"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
OpenPos = OpenPos + 1
Next
re.Pattern = "\" + arrTags(i) + "\>"
Set strMatchs = re.Execute(strContent)
For Each Match in strMatchs
ClosePos = ClosePos + 1
Next
For j = 1 To OpenPos - ClosePos
strContent = strContent + "" + arrTags(i) + ">"
Next
Next
closeHTML = strContent
End Function
'*************************************
'读取文件
'*************************************
Function LoadFromFile(ByVal File)
Dim objStream
Dim RText
RText = Array(0, "")
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Type = 2
.Mode = 3
.Open
.Charset = "utf-8"
.Position = objStream.Size
On Error Resume Next
.LoadFromFile Server.MapPath(File)
If Err Then
RText = Array(Err.Number, Err.Description)
LoadFromFile = RText
Err.Clear
Exit Function
End If
RText = Array(0, .ReadText)
.Close
End With
LoadFromFile = RText
Set objStream = Nothing
End Function
'*************************************
'保存文件
'*************************************
Function SaveToFile(ByVal strBody, ByVal File)
Dim objStream
Dim RText
RText = Array(0, "")
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
.Type = 2
.Open
.Charset = "utf-8"
.Position = objStream.Size
.WriteText = strBody
On Error Resume Next
.SaveToFile Server.MapPath(File), 2
If Err Then
RText = Array(Err.Number, Err.Description)
SaveToFile = RText
Err.Clear
Exit Function
End If
.Close
End With
RText = Array(0, "保存文件成功!")
SaveToFile = RText
Set objStream = Nothing
End Function
'*************************************
'数据库添加修改操作
'*************************************
Function DBQuest(table, DBArray, Action)
Dim AddCount, TempDB, i, v
If Action<>"insert" Or Action<>"update" Then Action = "insert"
If Action = "insert" Then v = 2 Else v = 3
If Not IsArray(DBArray) Then
DBQuest = -1
Exit Function
Else
Set TempDB = Server.CreateObject("ADODB.RecordSet")
On Error Resume Next
TempDB.Open table, Conn, 1, v
If Err Then
DBQuest = -2
Exit Function
End If
If Action = "insert" Then TempDB.addNew
AddCount = UBound(DBArray, 1)
For i = 0 To AddCount
TempDB(DBArray(i)(0)) = DBArray(i)(1)
Next
TempDB.update
TempDB.Close
Set TempDB = Nothing
DBQuest = 0
End If
End Function
'*************************************
'显示帮助信息
'*************************************
Sub showmsg(title, des, icon, showType)
session(CookieName&"_ShowMsg") = True
session(CookieName&"_title") = title
session(CookieName&"_des") = des
session(CookieName&"_icon") = icon
'icon 类型
'MessageIcon
'ErrorIcon
'WarningIcon
'QuestionIcon
If showType = "plugins" Then
RedirectUrl("../../showmsg.asp")
Else
RedirectUrl("showmsg.asp")
End If
End Sub
'*************************************
'垃圾关键字过滤
'*************************************
Function filterSpam(Str, Path)
filterSpam = False
Dim spamXml, spamItem
Set spamXml = Server.CreateObject(getXMLDOM())
spamXml.async = False
spamXml.load(Server.MapPath(Path))
If spamXml.parseerror.errorcode = 0 Then
For Each spamItem in spamXml.selectNodes("//key")
If InStr(LCase(Str), LCase(spamItem.text))<>0 Then
filterSpam = True
Exit Function
End If
Next
End If
Set spamXml = Nothing
End Function
Function regFilterSpam(Str, Path)
regFilterSpam = False
Dim spamXml, spamItem, r
Set spamXml = Server.CreateObject(getXMLDOM())
spamXml.async = False
spamXml.load(Server.MapPath(Path))
If spamXml.parseerror.errorcode = 0 Then
For Each spamItem in spamXml.selectNodes("//key")
'r = rgExec(Str, spamItem.getAttribute("re"), spamItem.getAttribute("times"))
r = rgExec(str,replace(spamItem.getAttribute("re"),"\\","\"),spamItem.getAttribute("times"))
If r>0 Then
regFilterSpam = True
Exit Function
End If
Next
End If
Set spamXml = Nothing
End Function
Function getServerKey
Dim serverTime, diffDay
If Len(Application(CookieName&"_server_Time"))>0 Then '判断是否要更新serverKey
serverTime = Application(CookieName&"_server_Time")
diffDay = DateDiff("h", Now, serverTime)
If diffDay > 0 Or diffDay<0 Then updateServerKey '每个1个小时更新一次 serverKey
Else
updateServerKey
End If
Dim exc
exc = Split(Application(CookieName&"_server_excursion"), "|")
Dim sKey
sKey = exc(0) & Request.ServerVariables("INSTANCE_META_PATH") & Request.ServerVariables("APPL_PHYSICAL_PATH") & Request.ServerVariables("SERVER_SOFTWARE")
getServerKey = Mid(sha1(sKey), exc(1) + 1, 10)
End Function
Function updateServerKey
Randomize
Application.Lock
Application(CookieName&"_server_Time") = Now
Application(CookieName&"_server_excursion") = Int(Rnd * 10000000) & "|" & Int(Rnd * 26)
Application.UnLock
End Function
Function getTempKey
getTempKey = randomStr(20)
session(CookieName&"tempKey") = getTempKey
End Function
'*************************************
'水印函数
'*************************************
Sub CreateView(imgName,mode,UpLoadSet)
'imgName:图片地址,mode:水印样式,UpLoadSet:水印参数
'UpLoadSet = "0|0|0|PJBlog|PJBlog|0|1|10|10|FFFFFF|0|10|10|0.5|images/wind.png|120|35|www.pjhome.net|FFFFFF|18|宋体|1|0|000000|0|0"
'防盗链|文件命名|文件命名2|前缀|后缀|水印位置|计数边距|离左边距|离顶边距|边框颜色|边框宽度|水平边距|垂直边距|透明度|图片水印|图宽|图高|文字|字体颜色|字体大小|字体类型|加粗|斜体|阴影颜色|阴影向右偏移量|阴影向下偏移量
' 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
UpLoadSet = Split(UpLoadSet,"|")
If UBound(UpLoadSet) <> 25 then
UpLoadSet = "0|0|0|PJBlog|PJBlog|0|0|10|10|FFFFFF|0|10|10|0.5|images/wind.png|120|35|www.pjhome.net|000000|18|宋体|1|0|000000|0|0"
UpLoadSet = Split(UpLoadSet,"|")
End If
Dim nSYWZPosition, UpPlace, UpCalculate, UpSYX, UpSYY, UpSYPenColor, UpSYPenWidth, UpSYPaddingH, UpSYPaddingV, UpSYAlpha
Dim UpPicPath, UpPicWidth, UpPicHeight
Dim UpCharacter, UpFontColor, UpFontSize, UpFontFamily, UpFontBold, UpFontItalic
Dim UpFontShadowColor, UpFontShadowXOffset, UpFontShadowYOffset
UpPlace = UpLoadSet(5) '水印位置
UpCalculate = UpLoadSet(6) '计数边距
UpSYX = UpLoadSet(7) '离左边距
UpSYY = UpLoadSet(8) '离顶边距
UpSYPenColor = "&H"&UpLoadSet(9) '边框颜色
UpSYPenWidth = UpLoadSet(10) '边框宽度
UpSYPaddingH = UpLoadSet(11) '水平边距
UpSYPaddingV = UpLoadSet(12) '垂直边距
UpSYAlpha = UpLoadSet(13) '透明度
UpPicPath = UpLoadSet(14) '图片水印
UpPicWidth = UpLoadSet(15) '图宽
UpPicHeight = UpLoadSet(16) '图高
UpCharacter = UpLoadSet(17) '文字
UpFontColor = "&H"&UpLoadSet(18) '字体颜色
UpFontSize = UpLoadSet(19) '字体大小
UpFontFamily = UpLoadSet(20) '字体类型
UpFontBold = CBool(UpLoadSet(21)) '加粗
UpFontItalic = CBool(UpLoadSet(22)) '斜体
UpFontShadowColor = "&H"&UpLoadSet(23) '阴影颜色
UpFontShadowXOffset = UpLoadSet(24) '阴影向右偏移量
UpFontShadowYOffset = UpLoadSet(25) '阴影向下偏移量
On Error Resume Next
Dim Jpeg,Logobox,LogoPath
Set Jpeg = Server.CreateObject("Persits.Jpeg")
dim UpSYHx,UpSYVy,UpjpegX,UpjpegY,UpfontX,UpfontY
If UpCalculate = 1 then
UpSYHx = 0
UpSYVy = 0
Else
UpSYHx = UpSYPaddingH
UpSYVy = UpSYPaddingV
End IF
If mode = 2 Then '图片水印
LogoPath = Server.MapPath(UpPicPath)
Set Logobox = Server.CreateObject("Persits.Jpeg")
Logobox.Open LogoPath
Logobox.Width = UpPicWidth
Logobox.Height = Logobox.Width * Logobox.OriginalHeight / Logobox.OriginalWidth
Jpeg.Open Trim(Server.MapPath(imgName))
If Jpeg.OriginalWidth > Logobox.Width and Jpeg.OriginalHeight > Logobox.Height then
UpjpegX = Jpeg.OriginalWidth-Logobox.Width-UpSYHx
UpjpegY = Jpeg.OriginalHeight-Logobox.Height-UpSYVy
Select Case UpPlace
Case 0 '水印随机位置
randomize
nSYWZPosition = Int(rnd()*9+1)
UpSYX = getSYPosX(nSYWZPosition, Jpeg.OriginalWidth, Logobox.Width, UpSYPaddingH )
UpSYY = getSYPosY(nSYWZPosition, Jpeg.OriginalHeight, Logobox.Height, UpSYPaddingV )
Case 1 '水印顶部左侧
UpSYX = UpSYHx
UpSYY = UpSYVy
Case 2 '水印顶部居中
UpSYX = UpjpegX \ 2
UpSYY = UpSYVy
Case 3 '水印顶部右侧
UpSYX = UpjpegX
UpSYY = UpSYVy
Case 4 '水印中部左侧
UpSYX = UpSYHx
UpSYY = UpjpegY \ 2
Case 5 '水印中部居中
UpSYX = UpjpegX \ 2
UpSYY = UpjpegY \ 2
Case 6 '水印中部右侧
UpSYX = UpjpegX
UpSYY = UpjpegY \ 2
Case 7 '水印底部左侧
UpSYX = UpSYHx
UpSYY = UpjpegY
Case 8 '水印底部居中
UpSYX = UpjpegX \ 2
UpSYY = UpjpegY
Case 9 '水印底部右侧
UpSYX = UpjpegX
UpSYY = UpjpegY
Case Else '水印默认位置
UpSYX = UpSYX
UpSYY = UpSYY
End Select
If UpSYPenWidth > 0 then
Jpeg.Canvas.Pen.Color = UpSYPenColor
Jpeg.Canvas.Pen.Width = UpSYPenWidth
Jpeg.Canvas.Brush.Solid = False
Jpeg.Canvas.Bar 0, 0, Jpeg.Width, Jpeg.Height
End If
Jpeg.DrawImage UpSYX, UpSYY, Logobox, UpSYAlpha, UpSYPenColor
Jpeg.Save Server.MapPath(imgName)
Logobox.close : Set Logobox = Nothing
Jpeg.close : Set Jpeg = Nothing
End If
Else '文字水印
Jpeg.Open Server.MapPath(imgName)
Dim aa,MyJpeg,Logo,bb
aa = Jpeg.Binary
If Jpeg.OriginalWidth>(len(UpCharacter)*UpFontsize) and Jpeg.OriginalHeight>(1*UpFontsize) then
UpfontX = Jpeg.OriginalWidth-(bLen(UpCharacter)*UpFontsize)+UpFontShadowXOffset-UpSYHx
UpfontY = Jpeg.OriginalHeight-UpFontsize+UpFontShadowYOffset-UpSYVy
Select Case UpPlace
Case 10 '水印随机位置
randomize
nSYWZPosition = Int(rnd()*9+1)
UpSYX = getSYPosX(nSYWZPosition, Jpeg.OriginalWidth, (bLen(UpCharacter)*UpFontsize)+UpFontShadowXOffset, UpSYPaddingH )
UpSYY = getSYPosY(nSYWZPosition, Jpeg.OriginalHeight, UpFontsize+UpFontShadowYOffset, UpSYPaddingV )
Case 1 '水印顶部左侧
UpSYX = UpSYHx
UpSYY = UpSYVy
Case 2 '水印顶部居中
UpSYX = UpfontX \ 2
UpSYY = UpSYVy
Case 3 '水印顶部右侧
UpSYX = UpfontX
UpSYY = UpSYVy
Case 4 '水印中部左侧
UpSYX = UpSYHx
UpSYY = UpfontY \ 2
Case 5 '水印中部居中
UpSYX = UpfontX \ 2
UpSYY = UpfontY \ 2
Case 6 '水印中部右侧
UpSYX = UpfontX
UpSYY = UpfontY \ 2
Case 7 '水印底部左侧
UpSYX = UpSYHx
UpSYY = UpfontY
Case 8 '水印底部居中
UpSYX = UpfontX \ 2
UpSYY = UpfontY
Case 9 '水印底部右侧
UpSYX = UpfontX
UpSYY = UpfontY
Case Else '水印默认位置
UpSYX = UpSYX
UpSYY = UpSYY
End Select
Jpeg.Canvas.Font.Color = UpFontColor
Jpeg.Canvas.Font.Family = UpFontFamily
Jpeg.Canvas.Font.Size = UpFontSize
Jpeg.Canvas.Font.Bold = UpFontBold
Jpeg.Canvas.Font.Italic = UpFontItalic
Jpeg.Canvas.Font.Quality = 2
Jpeg.Canvas.Font.ShadowColor = UpFontShadowColor
Jpeg.Canvas.Font.ShadowXOffset = UpFontShadowXOffset
Jpeg.Canvas.Font.ShadowYOffset = UpFontShadowYOffset
Jpeg.Canvas.Print UpSYX, UpSYY, UpCharacter
Set MyJpeg = Server.CreateObject("Persits.Jpeg")
MyJpeg.OpenBinary aa
MyJpeg.DrawImage 0,0, Jpeg, UpSYAlpha
If UpSYPenWidth > 0 then
MyJpeg.Canvas.Pen.Color = UpSYPenColor
MyJpeg.Canvas.Pen.Width = UpSYPenWidth
MyJpeg.Canvas.Brush.Solid = False
MyJpeg.Canvas.Bar 0, 0, MyJpeg.Width, MyJpeg.Height
End If
MyJpeg.Save Server.MapPath(imgName)
Jpeg.close
Set aa = nothing
MyJpeg.Close
End If
End If
End Sub
'*************************************
'识别中英文字符,计算文字水印长度
'*************************************
Function bLen(str)
Dim strLen,charLen,ascChar,i
strLen = len(str)
charLen = 0
For i = 1 to strLen
ascChar = asc(mid(str,i,1))
If ascChar < 0 then ascChar = ascChar+65536
If ascChar > 255 then
charLen= charLen + 1.02
Else
charLen = charLen + 0.56
End If
Next
bLen = charLen
End Function
'*************************************
'计算随机水印水平坐标(随机位置,原图宽度,水印宽度,左右边距)
'*************************************
Function getSYPosX(posFlag, originalW, syW, paddingH)
Select Case posFlag
Case 1, 2, 3
getSYPosX = paddingH
Case 4, 5, 6
getSYPosX = (originalW - syW) \ 2
Case 7, 8, 9
getSYPosX = originalW - paddingH - syW
End Select
End Function
'*************************************
'计算随机水印垂直坐标(随机位置,原图高度,水印高度,上下边距)
'*************************************
Function getSYPosY(posFlag, originalH, syH, paddingV)
Select Case posFlag
Case 1, 4, 7
getSYPosY = paddingV
Case 2, 5, 8
getSYPosY = (originalH - syH) \ 2
Case 3, 6, 9
getSYPosY = originalH - paddingV - syH
End Select
End Function
'*************************************
'截取文件名
'*************************************
Function getF_Name(n)
getF_Name = mid(n,1,Cint(InstrRev(n,"."))-1)
End Function
'*************************************
'日期补0
'*************************************
Function lenNum(n)
IF len(n)=1 then
lenNum="0"&n
Else
lenNum=n
End If
End Function
%>
<%
'===========PBlog2 UBB代码转换代码==========
' Author:PuterJam
' Copryright PBlog2
' Update: 2005-12-29
'===========================================
Function UBBCode(ByVal strContent, DisSM, DisUBB, DisIMG, AutoURL, AutoKEY)
If IsEmpty(strContent) Or IsNull(strContent) Then
Exit Function
Else
Dim re, strMatchs, strMatch, rndID, tmpStr1, tmpStr2, tmpStr3, tmpStr4
Set re = New RegExp
re.IgnoreCase = True
re.Global = True
If AutoURL = 1 Then
re.Pattern = "([^=\]][\s]*?|^)(http|https|rstp|ftp|mms|ed2k)://([A-Za-z0-9\.\/=\?%\-_~`@':+!]*)"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = strMatch.SubMatches(0)
tmpStr2 = strMatch.SubMatches(1)
tmpStr3 = checkURL(strMatch.SubMatches(2))
strContent = Replace(strContent, strMatch.Value, tmpStr1&""&tmpStr2&"://"&tmpStr3&"", 1, -1, 0)
Next
're.Pattern="(^|\s)(www\.\S+)"
'strContent=re.Replace(strContent,"$1$2")
End If
'防止xss注入
strContent = Replace(strContent, "expression", "expression", 1, -1, 0)
If Not DisUBB = 1 Then
If Not DisIMG = 1 Then
re.Pattern = "(\[img\])(.[^\]]*)\[\/img\]"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = (strMatch.SubMatches(1))
strContent = Replace(strContent, strMatch.Value, "", 1, -1, 0)
Next
re.Pattern = "\[img=(left|right|center|absmiddle|)\](.[^\]]*)(\[\/img\])"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = strMatch.SubMatches(0)
tmpStr2 = checkURL(strMatch.SubMatches(1))
strContent = Replace(strContent, strMatch.Value, "
", 1, -1, 0)
Next
re.Pattern = "\[img=(\d*|),(\d*|)\](.[^\]]*)\[\/img\]"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = strMatch.SubMatches(0)
tmpStr2 = strMatch.SubMatches(1)
tmpStr3 = checkURL(strMatch.SubMatches(2))
strContent = Replace(strContent, strMatch.Value, "
", 1, -1, 0)
Next
re.Pattern = "\[img=(\d*|),(\d*|),(left|right|center|absmiddle|)\](.[^\]]*)(\[\/img\])"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = strMatch.SubMatches(0)
tmpStr2 = strMatch.SubMatches(1)
tmpStr3 = strMatch.SubMatches(2)
tmpStr4 = checkURL(strMatch.SubMatches(3))
strContent = Replace(strContent, strMatch.Value, "
", 1, -1, 0)
Next
Else
re.Pattern = "(\[img\])(.[^\]]*)\[\/img\]"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = checkURL(strMatch.SubMatches(1))
strContent = Replace(strContent, strMatch.Value, "
查看图片", 1, -1, 0)
Next
re.Pattern = "\[img=(left|right|center|absmiddle|)\](.[^\]]*)(\[\/img\])"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = strMatch.SubMatches(0)
tmpStr2 = checkURL(strMatch.SubMatches(1))
strContent = Replace(strContent, strMatch.Value, "
查看图片", 1, -1, 0)
Next
re.Pattern = "\[img=(\d*|),(\d*|)\](.[^\]]*)\[\/img\]"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = strMatch.SubMatches(0)
tmpStr2 = strMatch.SubMatches(1)
tmpStr3 = checkURL(strMatch.SubMatches(2))
strContent = Replace(strContent, strMatch.Value, "
查看图片", 1, -1, 0)
Next
re.Pattern = "\[img=(\d*|),(\d*|),(left|right|center|absmiddle|)\](.[^\]]*)(\[\/img\])"
Set strMatchs = re.Execute(strContent)
For Each strMatch in strMatchs
tmpStr1 = strMatch.SubMatches(0)
tmpStr2 = strMatch.SubMatches(1)
tmpStr3 = strMatch.SubMatches(2)
tmpStr4 = checkURL(strMatch.SubMatches(3))
strContent = Replace(strContent, strMatch.Value, "
查看图片", 1, -1, 0)
Next
End If
'-----------多媒体标签----------------
re.Pattern = "\[(swf|wma|wmv|rm|ra|qt)(=\d*?|)(,\d*?|)\]([^<>]*?)\[\/(swf|wma|wmv|rm|ra|qt)\]"
Set strMatchs = re.Execute(strContent)
Dim strType, strWidth, strHeight, strSRC, TitleText
For Each strMatch in strMatchs
Randomize
strType = strMatch.SubMatches(0)
If strType = "swf" Then
TitleText = "
Flash动画"
ElseIf strType = "wma" Then
TitleText = "
播放音频文件"
ElseIf strType = "wmv" Then
TitleText = "
播放视频文件"
ElseIf strType = "rm" Then
TitleText = "
播放real视频流文件"
ElseIf strType = "ra" Then
TitleText = "
播放real音频流文件"
ElseIf strType = "qt" Then
TitleText = "
播放mov视频文件"
End If
strWidth = strMatch.SubMatches(1)
strHeight = strMatch.SubMatches(2)
If (Len(strWidth) = 0) Then
strWidth = "400"
Else
strWidth = Right(strWidth, (Len(strWidth) -1))
End If
If (Len(strHeight) = 0) Then
strHeight = "300"
Else
strHeight = Right(strHeight, (Len(strHeight) -1))
End If
strSRC = checkURL(strMatch.SubMatches(3))
rndID = "temp"&Int(100000 * Rnd)
strContent = Replace(strContent, strMatch.Value, "
Tags: <%=getTag.filterHTML(webLogArr(15,PageCount))%>
<% End If Else %>Tags: "&getTags.filterHTML(log_View("log_Tag"))&"
") Else Temp2 = Replace(Temp2, "<$log_tag$>", "") End If If log_View("log_ComOrder") Then comDesc = "Desc" Else comDesc = "Asc" End If If log_View("log_EditType") = 1 Then Temp2 = Replace(Temp2, "<$log_Intro$>", UnCheckStr(UBBCode(log_View("log_Intro"), Mid(log_View("log_UbbFlags"), 1, 1), Mid(log_View("log_UbbFlags"), 2, 1), Mid(log_View("log_UbbFlags"), 3, 1), Mid(log_View("log_UbbFlags"), 4, 1), Mid(log_View("log_UbbFlags"), 5, 1)))) If log_View("log_Intro")<>HtmlEncode(log_View("log_Content")) Then If blog_postFile = 2 and log_View("log_IsShow") and not getCate.cate_Secret Then Temp2 = Replace(Temp2, "<$log_readMore$>", "") Else Temp2 = Replace(Temp2, "<$log_readMore$>", "") End If Else Temp2 = Replace(Temp2, "<$log_readMore$>", "") End If Else Temp2 = Replace(Temp2, "<$log_Intro$>", UnCheckStr(log_View("log_Intro"))) If log_View("log_Intro")<>log_View("log_Content") Then If blog_postFile = 2 and log_View("log_IsShow") and not getCate.cate_Secret Then Temp2 = Replace(Temp2, "<$log_readMore$>", "") Else Temp2 = Replace(Temp2, "<$log_readMore$>", "") End If Else Temp2 = Replace(Temp2, "<$log_readMore$>", "") End If End If Temp2 = Replace(Temp2, "<$log_CommNums$>", log_View("log_CommNums")) Temp2 = Replace(Temp2, "<$log_QuoteNums$>", log_View("log_QuoteNums")) SaveArticle = SaveToFile(Temp2, "cache/" & LogID & ".asp") If memoryCache = true then Application.Lock Application(CookieName&"_introCache_"&LogID) = Temp2 Application.UnLock End If End Sub '====================================================== '模板文件保存到内存里 '====================================================== Sub LoadTemplateFile(Path) Dim cache End Sub %> <% '================================== ' 系统首页 ' 更新时间: 2006-1-15 '================================== %>Powered By PJBlog3 v<%=blog_version%> CopyRight 2005 - 2008, <%=SiteName%> xhtml | css
Processed in <%=FormatNumber(Timer()-StartTime,6,-1)%> second(s) , <%=SQLQueryNums%> queries<%=SkinInfo%>
<%=blogabout%>