⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 #search.mo

📁 WAPmo手机网站管理平台是一款创建与管理维护WAP网站的的软件产品
💻 MO
字号:
Option Explicit

TBBS.AddLang "common|head|foot|error|search"
TBBS.SetNodes "env|user|forums"

TBBS.AddNav "", TBBS.Lang("search")
TBBS.Page("name") = TBBS.GetNav()
TBBS.AddOnline 0, TBBS.Page("name")

TBBS.Vars("skin") = "default"

If TBBS.Permit("search") = 0 Then
    TBBS.AddError "ps_search", Array()
Else
    Call main
End If

Private Sub doGet()
    TBBS.Vars("state") = 1
    TBBS.Vars("type") = atoi(MyIO.QueryString("type"))
    TBBS.Vars("key") = Trim(MyIO.QueryString("key"))
    TBBS.Vars("fid") = atol(MyIO.QueryString("fid"))
    If Len(TBBS.Vars("key")) = 0 Then
    ElseIf Len(TBBS.Vars("key")) < atoi(TBBS.Env("key_min_size")) Then
        TBBS.AddHint "key_too_short", Array()
    ElseIf Len(TBBS.Vars("key")) > atoi(TBBS.Env("key_max_size")) Then
        TBBS.AddHint "key_too_long", Array()
    Else
        TBBS.Vars("state") = 2
        Call SetPage
    End If
End Sub

Private Sub doPost()
    TBBS.AddError "invalid_handle", Array()
End Sub

Private Sub SetPage()
    Dim lngId, lngRows, lngSize, lngTotal, lngMove, lngFlag
    lngId = atoi(MyIO.QueryString("page"))
    If lngId < 1 Then lngId = 1
    lngRows = GetRows()
    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_TOPIC
    TBBS.Page("column") = "SEQID,FORUMID,FORUMNAME,TITLE,USERID,USERNAME,REPLIES,HITS,LASTPOSTID,LASTPOSTTITLE,LASTPOSTUSERID,LASTPOSTUSERNAME,LASTPOSTTIME,TOPTYPE"
    TBBS.Page("where") = GetWhere()
    TBBS.Page("sort") = "SEQID ASC"
    TBBS.Page("sorttype") = 0
    TBBS.Page("index") = "SEQID"
    TBBS.SetPagePrefix "search.asp", Array("type", "key"), Array(TBBS.Vars("type"), TBBS.Vars("key"))
    TBBS.SetPageXML "topics", "topic", True
End Sub

Private Function GetRows()
    Dim strSQL
    strSQL = "SELECT COUNT(1) FROM $(Table) WHERE $(Where)"
    strSQL = Replace(strSQL, "$(Table)", T_TOPIC)
    strSQL = Replace(strSQL, "$(Where)", GetWhere())
    GetRows = atol(MyKernel.DB.GetRow(strSQL))
End Function

Private Function GetWhere()
    Dim ret
    Select Case TBBS.Vars("type")
    Case 0
        ret = "FOLLOW=0 AND TITLE LIKE '%$(Key)%'$(Forum)"
    Case 1
        ret = "FOLLOW=0 AND CONTENT LIKE '%$(Key)%'$(Forum)"
    Case 2
        ret = "FOLLOW=0 AND USERNAME='$(Key)'$(Forum)"
    Case 3
        ret = "FOLLOW=0 AND TOPTYPE>0 AND USERNAME='$(Key)'$(Forum)"
    Case Else
        ret = "0=1"
    End Select
    If TBBS.Vars("fid") < 1 Then
        ret = Replace(ret, "$(Forum)", "")
    Else
        ret = Replace(ret, "$(Forum)", " AND FORUMID=" & TBBS.Vars("fid"))
    End If
    ret = Replace(ret, "$(Key)", SafeString(TBBS.Vars("key")))
    GetWhere = ret
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -