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

📄 module_config.asp

📁 JTBC网站内容管理系统是一套可扩充的网站内容管理系统
💻 ASP
📖 第 1 页 / 共 4 页
字号:

Function module_data_topic_edit()
  Dim tid: tid = get_num(request.querystring("tid"), 0)
  Dim tbackurl: tbackurl = get_safecode(request.querystring("backurl")) 
  If Not check_forum_isauthor(tid, nusername) Then Call imessage(itake("module.topicedit_error", "lng"), -1)
  Call set_forum_ndatabase("topic")
  sqlstr = "select * from " & ndatabase & " where " & nidfield & "=" & tid
  Set rs = conn.Execute(sqlstr)
  Dim tcontent_database
  If Not rs.EOF Then
    Dim tmpstr, tmpi, tmpfields, tmpfieldsvalue
    tmpstr = itake("module.data_topic_edit", "tpl")
    For tmpi = 0 To rs.fields.Count - 1
      tmpfields = rs.fields(tmpi).Name
      tmpfieldsvalue = get_str(rs(tmpfields))
      If tmpfields = cfname("content_database") Then tcontent_database = tmpfieldsvalue
      tmpstr = Replace(tmpstr, "{$" & Replace(tmpfields, nfpre, "") & "}", htmlencode(tmpfieldsvalue))
    Next
    tmpstr = Replace(tmpstr, "{$tid}", get_str(rs(nidfield)))
  End If
  Set rs = Nothing
  tmpstr = replace(tmpstr, "{$content}", htmlencode(get_forum_content(tcontent_database, tid)))
  tmpstr = replace(tmpstr, "{$backurl}", urlencode(tbackurl))
  tmpstr = creplace(tmpstr)
  module_data_topic_edit = tmpstr
End Function

Function jtb_cms_module_index()
  Dim tmpstr: tmpstr = ireplace("module.index", "tpl")
  jtb_cms_module_index = tmpstr
End Function

Function jtb_cms_module_topic_list()
  Dim tmpstr: tmpstr = ireplace("module.topic_list", "tpl")
  jtb_cms_module_topic_list = tmpstr
End Function

Function jtb_cms_module_topic_detail()
  Dim tmpstr: tmpstr = ireplace("module.topic_detail", "tpl")
  jtb_cms_module_topic_detail = tmpstr
End Function

Function jtb_cms_module_topic_release()
  Call isuserlogin("0")
  Dim tmpstr: tmpstr = ireplace("module.topic_release", "tpl")
  jtb_cms_module_topic_release = tmpstr
End Function

Function jtb_cms_module_topic_edit()
  Dim tmpstr: tmpstr = ireplace("module.topic_edit", "tpl")
  jtb_cms_module_topic_edit = tmpstr
End Function

Function jtb_cms_module_manage_topic()
  Dim tmpstr: tmpstr = ireplace("module.manage_topic", "tpl")
  jtb_cms_module_manage_topic = tmpstr
End Function

Function jtb_cms_module_manage_detail()
  Dim tmpstr: tmpstr = ireplace("module.manage_detail", "tpl")
  jtb_cms_module_manage_detail = tmpstr
End Function

Function jtb_cms_module_manage_blacklist()
  Dim tmpstr: tmpstr = ireplace("module.manage_blacklist", "tpl")
  jtb_cms_module_manage_blacklist = tmpstr
End Function

Function jtb_cms_module_manage()
  Call isuserlogin("0")
  Dim tsid: tsid = get_num(request.querystring("sid"), 0)
  forum_isadmin = check_forum_isadmin(tsid)
  If forum_isadmin = 0 Then Call imessage(itake("config.admininfo", "lng"), -1)
  Select Case request.querystring("mtype")
    Case "topic"
      jtb_cms_module_manage = jtb_cms_module_manage_topic
    Case "detail"
      jtb_cms_module_manage = jtb_cms_module_manage_detail
    Case "blacklist"
      jtb_cms_module_manage = jtb_cms_module_manage_blacklist
    Case Else
      jtb_cms_module_manage = jtb_cms_module_manage_topic
  End Select
End Function

Function jtb_cms_module
  Select Case request.querystring("type")
    Case "manage"
      jtb_cms_module = jtb_cms_module_manage
    Case "list"
      jtb_cms_module = jtb_cms_module_topic_list
    Case "detail"
      jtb_cms_module = jtb_cms_module_topic_detail
    Case "release"
      jtb_cms_module = jtb_cms_module_topic_release
    Case "edit"
      jtb_cms_module = jtb_cms_module_topic_edit
    Case Else
      jtb_cms_module = jtb_cms_module_index
  End select
End Function

Sub jtb_cms_module_topic_releasedisp()
  Call isuserlogin(get_actual_route(ngenre))
  Dim tsid: tsid = get_num(request.querystring("sid"), 0)
  Dim tforum_popedom: tforum_popedom = check_forum_popedom(tsid, 1)
  If tforum_popedom = 1 Then Call imessage(itake("module.pdm_type", "lng"), -1)
  If tforum_popedom = 2 Then Call imessage(itake("module.pdm_mode", "lng"), -1)
  If tforum_popedom = 3 Then Call imessage(itake("module.popedom", "lng"), -1)
  If check_forum_blacklist(tsid) Then Call imessage(itake("module.inblacklist", "lng"), -1)
  Call check_valcode(-1)
  Dim tmpchkstr, tmpcitem
  tmpchkstr = "topic:" & itake("config.topic", "lng") & ",content:" & itake("config.content", "lng")
  For Each tmpcitem In Split(tmpchkstr, ",")
    If check_null(request.Form(Split(tmpcitem, ":")(0))) Then
      Call client_alert(replace_template(itake("global.lng_error.insert_empty", "lng"), "[]", "[" & Split(tmpcitem, ":")(1) & "]"), -1)
    End If
  Next
  Dim tvoteid
  Dim tvote_type: tvote_type = get_num(request.form("vote_type"), 0)
  Dim tvote_day: tvote_day = get_num(request.form("vote_day"), -1)
  Dim tvote_content: tvote_content = get_str(request.form("vote_content"))
  If not check_null(tvote_content) Then
    Dim tvote_contentary: tvote_contentary = split(tvote_content, vbcrlf)
    Dim tvi, tvub, tvote_content2, tvote_contentary2
    tvub = UBound(tvote_contentary)
    For tvi = 0 to tvub
      If not check_null(tvote_contentary(tvi)) Then
        tvote_content2 = tvote_content2 & tvote_contentary(tvi) & vbcrlf
      End If
    Next
    tvote_contentary2 = split(tvote_content2, vbcrlf)
    If UBound(tvote_contentary2) > max_vote_option or UBound(tvote_contentary2) < 2 Then
      Call client_alert(itake("config.voteerror", "lng"), -1)
    End If
    Call set_forum_ndatabase("vote")
    sqlstr = "select * from " & ndatabase
    Set rs = server.CreateObject("adodb.recordset")
    rs.open sqlstr, conn, 1, 3
    rs.addnew
    rs(cfname("topic")) = left_intercept(get_str(request.Form("topic")), 50)
    rs(cfname("type")) = tvote_type
    rs(cfname("time")) = Now()
    rs(cfname("day")) = tvote_day
    rs.update
    tvoteid = rs(nidfield)
    If get_num(tvoteid, 0) = 0 Then tvoteid = get_topid(ndatabase, nidfield)
    rs.close
    Call set_forum_ndatabase("vote_data")
    sqlstr = "select * from " & ndatabase
    Set rs = server.CreateObject("adodb.recordset")
    rs.open sqlstr, conn, 1, 3
    For tvi = 0 to UBound(tvote_contentary2)
      If not check_null(tvote_contentary2(tvi)) Then
        rs.addnew
        rs(cfname("topic")) = left_intercept(tvote_contentary2(tvi), 50)
        rs(cfname("fid")) = tvoteid
        rs(cfname("vid")) = tvi
        rs.update
      End If
    Next
    rs.close
  End If
  Call set_forum_ndatabase("topic")
  Dim tid
  sqlstr = "select * from " & ndatabase
  Set rs = server.CreateObject("adodb.recordset")
  rs.open sqlstr, conn, 1, 3
  rs.addnew
  rs(cfname("sid")) = tsid
  rs(cfname("fid")) = 0
  rs(cfname("icon")) = get_num(request.Form("icon"), 0)
  rs(cfname("topic")) = left_intercept(get_str(request.Form("topic")), 50)
  rs(cfname("author")) = nusername
  rs(cfname("authorip")) = nuserip
  rs(cfname("voteid")) = get_num(tvoteid, 0)
  rs(cfname("content_database")) = get_str(get_value(ngenre & ".ndatabase_data"))
  rs(cfname("ubb")) = get_num(request.Form("ubb"), 0)
  If tforum_popedom = 2.5 Then rs(cfname("hidden")) = 1
  rs(cfname("time")) = Now()
  rs(cfname("lasttime")) = Now()
  rs.update
  tid = rs(nidfield)
  If get_num(tid, 0) = 0 Then tid = get_topid(ndatabase, nidfield)
  rs.close
  Call set_forum_ndatabase("data")
  sqlstr = "select * from " & ndatabase
  rs.open sqlstr, conn, 1, 3
  rs.addnew
  rs(cfname("tid")) = tid
  rs(cfname("content")) = left_intercept(get_str(request.Form("content")), 100000)
  rs.update
  rs.close
  Call set_forum_ndatabase("sort")
  sqlstr = "select * from " & ndatabase & " where " & nidfield & "=" & tsid
  rs.open sqlstr, conn, 1, 3
  If Not rs.EOF then
    rs(cfname("ntopic")) = rs(cfname("ntopic")) + 1
    rs(cfname("nnote")) = rs(cfname("nnote")) + 1
    rs(cfname("last_topic")) = left_intercept(get_str(request.Form("topic")), 50)
    rs(cfname("last_tid")) = tid
    rs(cfname("last_time")) = Now()
    If DateDiff("d", rs(cfname("today_date")), format_date(Now(), 1)) = 0 Then
      rs(cfname("today_ntopic")) = rs(cfname("today_ntopic")) + 1
    Else
      rs(cfname("today_date")) = format_date(Now(), 1)
      rs(cfname("today_ntopic")) = 1
    End If
    rs.update
  End If
  rs.close
  Set rs = nothing
  Call update_userproperty("topic", 1, 0, nusername)
  Call update_userproperty("integral", nint_topic, 0, nusername)
  response.redirect "?type=list&sid=" & tsid
End Sub

Sub jtb_cms_module_topic_votedisp()
  Dim tid: tid = get_num(request.querystring("id"), 0)
  Dim tbackurl: tbackurl = get_safecode(request.querystring("backurl"))
  If get_num(request.cookies("forum_vote")(CStr(tid)), 0) = 1 Then Call client_alert(itake("vote.failed", "lng"), -1)
  Dim tvotes: tvotes = get_str(request.form("votes"))
  If check_null(tvotes) Then Call client_alert(itake("vote.error1", "lng"), -1)
  Dim tdatabase, tidfield, tfpre
  tdatabase = cndatabase(ngenre, "vote")
  tidfield = cnidfield(ngenre, "vote")
  tfpre = cnfpre(ngenre, "vote")
  sqlstr = "select * from " & tdatabase & " where " & tidfield & "=" & tid
  Set rs = conn.Execute(sqlstr)
  If not rs.EOF Then
    If not get_num(rs(cfnames(tfpre, "day")), 0) = -1 Then
      If DateDiff("d", get_date(rs(cfnames(tfpre, "time"))), Now()) > get_num(rs(cfnames(tfpre, "day")), 0) Then Call client_alert(itake("vote.error2", "lng"), -1)
    End If
    If rs(cfnames(tfpre, "type")) = 0 Then
      tvotes = get_num(tvotes, 0)
      If tvotes = 0 Then Call client_alert(itake("vote.error3", "lng"), -1)
    Else
      tvotes = format_checkbox(tvotes)
      If Not cidary(tvotes) Then Call client_alert(itake("vote.error3", "lng"), -1)
    End If
  Else
    Call client_alert(itake("vote.error4", "lng"), -1)
  End If
  Set rs = Nothing
  tdatabase = cndatabase(ngenre, "vote_voter")
  tidfield = cnidfield(ngenre, "vote_voter")
  tfpre = cnfpre(ngenre, "vote_voter")
  sqlstr = "select * from " & tdatabase & " where " &  cfnames(tfpre, "fid") & "=" & tid & " and " & cfnames(tfpre, "ip") & "='" & nuserip & "'"
  Set rs = server.CreateObject("adodb.recordset")
  rs.open sqlstr, conn, 1, 3
  If Not rs.EOF Then
    Call client_alert(itake("vote.error5", "lng"), -1)
  Else
    rs.addnew
    rs(cfnames(tfpre, "fid")) = tid
    rs(cfnames(tfpre, "ip")) = nuserip

⌨️ 快捷键说明

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