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

📄 query.asp

📁 WAPmo手机网站管理平台是一款创建与管理维护WAP网站的的软件产品
💻 ASP
字号:
<%
Class ImplMocomWAPmoWAPQuery
Private Sub Class_Initialize()
    Set MyXML = MyKernel.XMLParser
End Sub

Private Sub Class_Terminate()
End Sub

Public Sub main()
    MyXML.Align = "center"
    MyXML.Println MyKernel.Config("QueryTitle")
    MyXML.Align = "left"
    If MyKernel.Config("IsQuery") <> "1" Then
        MyXML.Println "该功能已被站长关闭"
    ElseIf MyIO.Env("REQUEST_METHOD") = "POST" Then
        Call doPost
    Else
        Call doGet
    End If
    Call ExportForm
    Call BackHomeX(QUERY_SEQID)
    Call SetLog("query", 0)
    Call MyKernel.OutputXML(Empty)
End Sub

Private Sub doGet()
    Dim lngStaple
    Dim intCate
    Dim strKey
    lngStaple = atol(MyIO.QueryString("Staple"))
    intCate = atoi(MyIO.QueryString("Category"))
    strKey = Trim(MyIO.QueryString("Keyword"))
    If Len(strKey) > 1 Then
        Call doGetQuery(lngStaple, intCate, strKey)
    End If
End Sub

Private Sub doPost()
End Sub

Private Sub doGetQuery(ByVal lngStaple, ByVal intCate, ByVal strKey)
    Dim objPage, xmlNode
    Dim i
    Set objPage = vbsre.mocom.WAPmo.Page.newInstance()
    objPage.ID = atol(MyIO.QueryString("Page"))
    objPage.Size = 10
    objPage.DataType = WM_DataType
    objPage.Column = "SEQID,STAPLEID,STAPLETITLE,CATE,TITLE,MATTER,HIT,INTIME"
    objPage.Table = T_CONTENT
    objPage.Where = "HIDDEN=0 AND EXAMINE=1"
    Select Case intCate
    Case 50
        objPage.Where = objPage.Where & " AND CONTENT LIKE '%$(Keyword)%'"
    Case 100
        objPage.Where = objPage.Where & " AND (TITLE LIKE '%$(Keyword)%' Or CONTENT LIKE '%$(Keyword)%')"
    Case Else
        objPage.Where = objPage.Where & " AND TITLE LIKE '%$(Keyword)%'"
    End Select
    If lngStaple > 0 Then
        objPage.Where = objPage.Where & GetStapleWhere(lngStaple)
    ElseIf ValidCoop() Then
        objPage.Where = objPage.Where & GetCoopWhere()
    End If
    objPage.Where = Replace(objPage.Where, "$(Keyword)", SafeString(strKey))
    objPage.Count = GetPageCount(objPage)
    objPage.Index = "SEQID"
    objPage.Sort = "SEQID DESC"
    objPage.SortType = 1
    objPage.Build "contents", "content"
    MyXML.Println "搜索到" & objPage.Count & "条与[" & strKey & "]相关的内容"
    If objPage.Rows.hasChildNodes Then
        i = 0
        For Each xmlNode In objPage.Rows.childNodes
            MyXML.Printf "["
            MyXML.Printf MyXML.CreateA(GetStapleURL(XMLAttr(xmlNode, "stapleid"), 1), XMLAttr(xmlNode, "stapletitle"), "", "")
            MyXML.Printf "]"
            MyXML.Println MyXML.CreateA(GetContentURL(XMLAttr(xmlNode, "stapleid"), 1, XMLAttr(xmlNode, "cate"), XMLAttr(xmlNode, "seqid"), XMLAttr(xmlNode, "intime"), 1), ((objPage.ID - 1) * objPage.Size + i + 1) & "." & XMLAttr(xmlNode, "title"), "", "")
            i = i + 1
        Next
        MyXML.Println ""
        Dim arr1, arr2
        arr1 = Array("Staple", "Category", "Keyword", "Page")
        arr2 = Array(lngStaple, intCate, strKey, 0)
        If objPage.ID < objPage.Total Then
            arr2(3) = objPage.ID + 1
            MyXML.Printf MyXML.CreateA(GetURL("query.asp", arr1, arr2), "下一页", "", "")
            MyXML.Printf "|"
            arr2(3) = objPage.Total
            MyXML.Println MyXML.CreateA(GetURL("query.asp", arr1, arr2), "最末页", "", "")
        End If
        If objPage.ID > 1 Then
            arr2(3) = objPage.ID - 1
            MyXML.Printf MyXML.CreateA(GetURL("query.asp", arr1, arr2), "上一页", "", "")
            MyXML.Printf "|"
            arr2(3) = 1
            MyXML.Println MyXML.CreateA(GetURL("query.asp", arr1, arr2), "第一页", "", "")
        End If
        If objPage.Total > 2 Then
            MyXML.SetF "query.asp", "get", "", True
            MyXML.SetN "Staple", "hidden", lngStaple, "", "", False, 0, 0, ""
            MyXML.SetN "Category", "hidden", intCate, "", "", False, 0, 0, ""
            MyXML.SetN "Keyword", "hidden", strKey, "", "", False, 0, 0, ""
            MyXML.SetN "Page", "text", "", objPage.ID & "/" & objPage.Total & "页>>跳到", "页", False, 5, 5, "*N"
            Call SetQuery
            MyXML.SetN "", "submit", "GO", "", "", True, 0, 0, ""
        End If
        MyXML.Println ""
    End If
    Set objPage = Nothing
End Sub

Private Sub ExportForm()
    MyXML.SetF "query.asp", "get", "", True
    Call SetQuery
    If MyKernel.Config("QueryStaple") = "1" Then
        MyXML.SetS "Staple", atol(MyIO.QueryString("Staple")), "选择栏目:", "", True
        MyXML.SetO 0, "所有栏目"
        If ValidCoop() Then
            Call ExportCoopStaple
        Else
            Call ExportStaple
        End If
    End If
    MyXML.SetN "Keyword", "text", MyIO.QueryString("Keyword"), "搜索单词:", " 最少两个字符", True, 0, 0, ""
    MyXML.SetS "Category", atoi(MyIO.QueryString("Category")), "搜索选项:", "", True
    MyXML.SetO "0", "标题"
    MyXML.SetO "50", "内容"
    MyXML.SetO "100", "标题和内容"
    MyXML.SetN "", "submit", "搜索", "", "", True, 0, 0, ""
End Sub

Private Function GetCoopWhere()
    Dim xmlDoc, xmlNodes, xmlNode
    Dim ret, tmp, i
    If MyCoop("Staple") = "" Then
        ret = " AND 0=1"
    Else
        Set xmlDoc = WM_GetCache("staple")
        Set xmlNodes = XMLQueries(xmlDoc.documentElement, "staple[@seqid = " & Replace(MyCoop("Staple"), ",", " or @seqid = ") & "]")
        If xmlNodes.length = 0 Then
            ret = " AND 0=1"
        Else
            ReDim tmp(xmlNodes.length - 1)
            For i = 0 To xmlNodes.length - 1
                If WM_DataType = adOracle Then
                    tmp(i) = "(MARK='$(Mark)' OR SUBSTR(MARK,$(Length))='$(Mark)_')"
                Else
                    tmp(i) = "(MARK='$(Mark)' OR LEFT(MARK,$(Length))='$(Mark)_')"
                End If
                tmp(i) = Replace(tmp(i), "$(Length)", Len(XMLAttr(XMLNodes(i), "mark")) + 1)
                tmp(i) = Replace(tmp(i), "$(Mark)", SafeString(XMLAttr(XMLNodes(i), "mark")))
            Next
            ret = " AND (" & Join(tmp, " OR ") & ")"
        End If
        Set xmlNodes = Nothing
        Set xmlDoc = Nothing
    End If
    GetCooopWhere = ret
End Function

Private Function GetStapleWhere(ByVal lngID)
    Dim xmlDoc, xmlNode, strMark, ret
    Set xmlDoc = WM_GetCache("staple")
    Set xmlNode = XMLQuery(xmlDoc.documentElement, "staple[@seqid=" & lngID & " and @hidden = 0 and @category = " & wmStapleNormal & "]")
    If Not xmlNode Is Nothing Then
        strMark = XMLAttr(xmlNode, "mark")
    End If
    Set xmlNode = Nothing
    Set xmlDoc = Nothing
    If strMark = "" Then Exit Function
    ret = " AND (STAPLEID=$(StapleId) Or LEFT(MARK,$(Length))='$(Mark)_')"
    ret = Replace(ret, "$(StapleId)", lngID)
    ret = Replace(ret, "$(Length)", Len(strMark) + 1)
    ret = Replace(ret, "$(Mark)", SafeString(strMark))
    GetStapleWhere = ret
End Function

Private Sub ExportStaple()
    Dim xmlDoc
    Set xmlDoc = WM_GetCache("staple")
    ExportStapleX xmlDoc, 0, 0, atoi(MyKernel.Config("QueryDepth"))
    Set xmlDoc = Nothing
End Sub

Private Sub ExportStapleX(xmlDoc, ByVal lngFollow, ByVal intDeep, ByVal intDepth)
    Dim xmlNodes, xmlNode
    Set xmlNodes = XMLQueries(xmlDoc.documentElement, "staple[@hidden = 0 and @category = " & wmStapleNormal & " and @follow=" & lngFollow & "]")
    For Each xmlNode In xmlNodes
        MyXML.SetO XMLAttr(xmlNode, "seqid"), String(intDeep * 2, "-") & XMLAttr(xmlNode, "title")
        If intDepth > 0 And intDeep <> intDepth Then
            ExportStapleX xmlDoc, XMLAttr(xmlNode, "seqid"), intDeep + 1, intDepth
        End If
    Next
End Sub

Private Sub ExportCoopStaple()
    Dim xmlDoc, xmlNodes, xmlNode
    If MyCoop("Staple") = "" Then Exit Sub
    Set xmlDoc = WM_GetCache("staple")
    Set xmlNodes = XMLQueries(xmlDoc.documentElement, "staple[@seqid = " & Replace(MyCoop("Staple"), ",", " or @seqid = ") & "]")
    For Each xmlNode In xmlNodes
        MyXML.SetO XMLAttr(xmlNode, "seqid"), XMLAttr(xmlNode, "title")
    Next
    Set xmlNodes = Nothing
    Set xmlDoc = Nothing
End Sub

Public Function newInstance()
    Set newInstance = New ImplMocomWAPmoWAPQuery
End Function
End Class
%>

⌨️ 快捷键说明

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