📄 #my.mo
字号:
Option Explicit
TBBS.AddLang "common|head|foot|error|my"
TBBS.SetNodes "env|user"
TBBS.AddNav "my.asp", TBBS.Lang("console")
TBBS.Vars("skin") = "default"
If TBBS.Permit("console") = 0 Then
TBBS.AddError "console", Array()
Else
Call main
TBBS.Page("name") = TBBS.GetNav()
TBBS.AddOnline 0, TBBS.Page("name")
End If
Private Sub doGet()
Select Case TBBS.Vars("handle")
Case "fav"
Call doGetFav
Case "msgbox"
Call doGetMsgbox
Case "friend"
TBBS.AddNav "", TBBS.Lang("my_friend")
Case "file"
Call doGetFile
Case "passwd"
TBBS.Vars("state") = 0
Case Else
Call doGetIndex
End Select
End Sub
Private Sub doPost()
Select Case TBBS.Vars("handle")
Case "msgbox"
Call doPostMsgbox
Case "file"
Call doPostFile
Case "passwd"
Call doPostPasswd
Case Else
TBBS.AddError "invalid_handle", Array()
End Select
End Sub
Private Sub doGetIndex()
Dim strSQL
strSQL = "SELECT TOP 5 * FROM $(Table) WHERE SENDTO='$(UserName)' ORDER BY SENDTIME DESC"
strSQL = Replace(strSQL, "$(Table)", T_INBOX)
strSQL = Replace(strSQL, "$(UserName)", MyKernel.Memory("username"))
TBBS.AppendXML MyKernel.DB.SQLToXML(strSQL, "smses", "sms"), True
strSQL = "SELECT TOP 5 * FROM $(Table) WHERE USERID=$(UserId) ORDER BY UPTIME DESC"
strSQL = Replace(strSQL, "$(Table)", T_UPLOAD)
strSQL = Replace(strSQL, "$(UserId)", MyKernel.Memory("seqid"))
TBBS.AppendXML MyKernel.DB.SQLToXML(strSQL, "files", "file"), True
End Sub
Private Sub doGetFav()
TBBS.AddNav "", TBBS.lang("my_fav")
Dim lngId, lngRows, lngSize, lngTotal, lngMove, lngFlag
lngId = atoi(MyIO.QueryString("page"))
If lngId < 1 Then lngId = 1
lngRows = atol(MyKernel.Memory("favs"))
lngSize = 10
lngTotal = (lngRows \ lngSize) + IIf(lngRows Mod lngSize = 0, 0, 1)
If lngTotal < 1 Then lngTotal = 1
If lngId > lngTotal Then lngId = lngTotal
If lngRows = 0 Then
lngMove = 0
lngFlag = 0
ElseIf lngId * lngSize >= lngRows Then
lngMove = IIf(lngRows Mod lngSize = 0, lngSize, lngRows Mod lngSize)
lngFlag = IIf(lngRows Mod lngSize = 0, lngRows - lngSize, lngRows - (lngRows Mod lngSize))
Else
lngMove = lngSize
lngFlag = (lngId - 1) * lngSize
End If
TBBS.Page("id") = lngId
TBBS.Page("rows") = lngRows
TBBS.Page("size") = lngSize
TBBS.Page("total") = lngTotal
TBBS.Page("move") = lngMove
TBBS.Page("flag") = lngFlag
TBBS.Page("datatype") = MyKernel.DB.DataType
TBBS.Page("table") = T_FAV
TBBS.Page("column") = "*"
TBBS.Page("where") = "USERID=" & MyKernel.Memory("seqid")
TBBS.Page("sort") = "SEQID DESC"
TBBS.Page("sorttype") = 1
TBBS.Page("index") = "SEQID"
TBBS.SetPagePrefix "my.asp", "handle", "fav"
TBBS.SetPageXML "favs", "fav", False
End Sub
Private Sub doGetMsgbox()
TBBS.AddNav "my.asp?handle=msgbox", TBBS.Lang("my_msgbox")
Select Case TBBS.Vars("action")
Case "outbox"
Call doGetOutbox
Case "send"
Call doGetSend
Case Else
Call doGetInbox
End Select
End Sub
Private Sub doGetInbox()
TBBS.Vars("id") = atol(Request.QueryString("id"))
If TBBS.Vars("id") > 0 Then
Call doGetInboxSMS
Else
Call doGetInboxList
End If
End Sub
Private Sub doGetInboxSMS()
Dim strSQL
Dim xmlDoc, xmlNode
Dim blnUpdate
blnUpdate = False
TBBS.AddNav "my.asp?handle=msgbox&action=inbox", TBBS.Lang("my_inbox")
strSQL = MyKernel.DB.GetLimitSQL(1, "*", T_INBOX, "SEQID=$(SeqId) AND SENDTO='$(Sendto)'", "", "")
strSQL = Replace(strSQL, "$(SeqId)", TBBS.Vars("id"))
strSQL = Replace(strSQL, "$(Sendto)", SafeString(MyKernel.Memory("username")))
Set xmlDoc = MyKernel.DB.SQLToXML(strSQL, "smses", "sms")
If Not xmlDoc.documentElement.hasChildNodes Then
TBBS.AddError "missing_sms", Array()
Else
TBBS.Vars("ubb") = TBBS.UBB("sms")
Set xmlNode = xmlDoc.documentElement.firstChild
TBBS.AddNav "", xmlNode.getAttribute("title")
blnUpdate = CBool(atoi(xmlNode.getAttribute("flag")) = 0)
If Not TBBS.HTML("sms") Then
xmlNode.setAttribute "content", reg_replace("([^>])(\r\n|\r|\n)", "g", "$1<br/>", MyIO.HTMLEncode(xmlNode.getAttribute("content")))
Else
xmlNode.setAttribute "content", reg_replace("([^>])(\r\n|\r|\n)", "g", "$1<br/>", xmlNode.getAttribute("content"))
End If
TBBS.AppendNode xmlNode
Set xmlNode = Nothing
End If
Set xmlDoc = Nothing
If blnUpdate Then
strSQL = "UPDATE $(Table) SET FLAG=1 WHERE SEQID=$(SeqId)"
strSQL = Replace(strSQL, "$(Table)", T_INBOX)
strSQL = Replace(strSQL, "$(SeqId)", TBBS.Vars("id"))
MyKernel.DB.Exec strSQL
strSQL = "UPDATE $(Table) SET MSGNEW=MSGNEW-1 WHERE SEQID=$(SeqId)"
strSQL = Replace(strSQL, "$(Table)", T_USER)
strSQL = Replace(strSQL, "$(SeqId)", MyKernel.Memory("seqid"))
MyKernel.DB.Exec strSQL
MyKernel.Memory("msgnew") = atol(MyKernel.Memory("msgnew")) - 1
End If
End Sub
Private Sub doGetInboxList
TBBS.AddNav "", TBBS.Lang("my_inbox")
Dim lngId, lngRows, lngSize, lngTotal, lngMove, lngFlag
lngId = atoi(MyIO.QueryString("page"))
If lngId < 1 Then lngId = 1
lngRows = atol(MyKernel.Memory("msgrecv"))
lngSize = 10
lngTotal = (lngRows \ lngSize) + IIf(lngRows Mod lngSize = 0, 0, 1)
If lngTotal < 1 Then lngTotal = 1
If lngId > lngTotal Then lngId = lngTotal
If lngRows = 0 Then
lngMove = 0
lngFlag = 0
ElseIf lngId * lngSize >= lngRows Then
lngMove = IIf(lngRows Mod lngSize = 0, lngSize, lngRows Mod lngSize)
lngFlag = IIf(lngRows Mod lngSize = 0, lngRows - lngSize, lngRows - (lngRows Mod lngSize))
Else
lngMove = lngSize
lngFlag = (lngId - 1) * lngSize
End If
TBBS.Page("id") = lngId
TBBS.Page("rows") = lngRows
TBBS.Page("size") = lngSize
TBBS.Page("total") = lngTotal
TBBS.Page("move") = lngMove
TBBS.Page("flag") = lngFlag
TBBS.Page("datatype") = MyKernel.DB.DataType
TBBS.Page("table") = T_INBOX
TBBS.Page("column") = "*"
TBBS.Page("where") = "SENDTO='" & SafeString(MyKernel.Memory("username")) & "'"
TBBS.Page("sort") = "SEQID DESC"
TBBS.Page("sorttype") = 1
TBBS.Page("index") = "SEQID"
TBBS.SetPagePrefix "my.asp", Array("handle", "action"), Array("msgbox", "inbox")
TBBS.SetPageXML "smses", "sms", False
End Sub
Private Sub doGetOutbox()
TBBS.Vars("id") = atol(Request.QueryString("id"))
If TBBS.Vars("id") > 0 Then
Call doGetOutboxSMS
Else
Call doGetOutboxList
End If
End Sub
Private Sub doGetOutboxSMS()
Dim strSQL, rs, ptr
Dim xmlNode
TBBS.AddNav "my.asp?handle=msgbox&action=outbox", TBBS.Lang("my_outbox")
strSQL = MyKernel.DB.GetLimitSQL(1, "*", T_OUTBOX, "SEQID=$(SeqId) AND SENDER='$(Sendto)'", "", "")
strSQL = Replace(strSQL, "$(SeqId)", TBBS.Vars("id"))
strSQL = Replace(strSQL, "$(Sendto)", SafeString(MyKernel.Memory("username")))
Set rs = MyKernel.DB.Exec2(strSQL)
If rs.EOF Then
TBBS.AddError "missing_sms", Array()
Else
If TBBS.UBB("sms") Then TBBS.Vars("ubb") = True
TBBS.AddNav "", rs("title")
Set xmlNode = TBBS.Element("sms")
For Each ptr In rs.Fields
If LCase(ptr.Name) = "content" Then
If Not TBBS.HTML("sms") Then
xmlNode.setAttribute LCase(ptr.Name), reg_replace("([^>])(\r\n|\r|\n)", "g", "$1<br/>", MyIO.HTMLEncode(ptr.Value))
Else
xmlNode.setAttribute LCase(ptr.Name), reg_replace("([^>])(\r\n|\r|\n)", "g", "$1<br/>", ptr.Value)
End If
Else
xmlNode.setAttribute LCase(ptr.Name), atos(ptr.Value)
End If
Next
Set xmlNode = Nothing
End If
rs.Close
Set rs = Nothing
End Sub
Private Sub doGetOutboxList
TBBS.AddNav "", TBBS.Lang("my_outbox")
Dim lngId, lngRows, lngSize, lngTotal, lngMove, lngFlag
lngId = atoi(MyIO.QueryString("page"))
If lngId < 1 Then lngId = 1
lngRows = atol(MyKernel.Memory("msgrecv"))
lngSize = 10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -