%@ CodePage=65001 Language="VBScript"%> <% Option Explicit %> <% sBBSLangPage = "quotes" BBS.SetupBBS BBS.SetScheme(0) dictEnvironment.item("V-LOCATIONLINKS") = dictEnvironment.item("V-LOCATIONLINKS") & " -> " & dictLanguage("GLOBAL-LOCATION13") dim SQL, index, iUpper, vArray, bIsModerator if dictConfiguration("bENABLEQUOTES") = 0 then response.redirect "../category-view.asp" if not(BBS.HasPermission(PERM_ViewBBS, -1)) then response.redirect sBBSForumRoot & "/logon.asp?error=needregistration" bIsModerator = (BBS.GetUserLevel(MODULE_Quotes, -1) >= USERLEVEL_ModuleAdministrator) if iBBSUserLevel >= USERLEVEL_User and dictConfiguration("bUSERSCANSUBMITQUOTES") then dictEnvironment("C-ADDQUOTE") = 1 elseif iBBSUserLevel < USERLEVEL_User and dictConfiguration("bUNREGISTEREDCANSUBMITQUOTES") then dictEnvironment("C-ADDQUOTE") = 1 elseif iBBSUserLevel >= USERLEVEL_SupportAdministrator then dictEnvironment("C-ADDQUOTE") = 1 else dictEnvironment("C-ADDQUOTE") = 0 end if if request.querystring("action") = "add" and dictEnvironment("C-ADDQUOTE") = 1 then if len(trim(request.form("message"))) > 0 then SQL = "insert into randomquotes (message, owner, registered, dateadded) values(" SQL = SQL & "'" & BBS.ValidateSQL(BBS.FilterPost(request.form("message"))) & "', " if iBBSUserLevel >= USERLEVEL_User then SQL = SQL & "'" & BBS.ValidateSQL(sBBSUsername) & "', 1, " else SQL = SQL & "'" & dictLanguage("GLOBAL-GUEST") & "', 0, " end if SQL = SQL & sDateDelimiter & BBS.GetSQLDateTime(now) & sDateDelimiter & ")" dbConnection.execute SQL BBS.AddQuery(SQL) response.redirect "view-random-quotes.asp" else dictEnvironment("V-MESSAGE") = dictLanguage("QUOTES-BLANK") end if BBS.CacheDelete "RANDOMQUOTES" end if if request.querystring("action") = "edit" then SQL = "select owner, registered, message from randomquotes where quoteid=" & BBS.ValidateNumeric(request.querystring("id")) rsMaster.open SQL, dbConnection, adOpenForwardonly, adlockreadonly BBS.AddQuery(SQL) if not rsMaster.eof then if ucase(rsmaster.fields("owner").value) = ucase(sBBSUsername) or bIsModerator then ' Go ahead and edit the quote dictEnvironment("C-SHOWEDIT") = 1 dictEnvironment("C-ADDQUOTE") = 0 dictEnvironment("C-MESSAGE") = rsMaster.fields("message").value dictEnvironment("U-POSTEDIT") = "view-random-quotes.asp?action=postedit&id=" & BBS.ValidateNumeric(request.querystring("id")) end if end if rsmaster.close end if if request.querystring("action") = "postedit" then if len(trim(request.form("message"))) > 0 then SQL = "select owner, registered from randomquotes where quoteid=" & BBS.ValidateNumeric(request.querystring("id")) rsMaster.open SQL, dbConnection, adOpenForwardonly, adlockreadonly BBS.AddQuery(SQL) if not rsMaster.eof then if ucase(rsmaster.fields("owner").value) = ucase(sBBSUsername) or bIsModerator then ' Go ahead and edit the quote SQL = "update randomquotes set message='" & BBS.ValidateSQL(BBS.FilterPost(request.form("message"))) & "' where quoteid=" & BBS.ValidateNumeric(request.querystring("id")) dbConnection.execute SQL BBS.AddQuery(SQL) end if end if rsmaster.close else dictEnvironment("V-MESSAGE") = dictLanguage("QUOTES-BLANK") end if BBS.CacheDelete "RANDOMQUOTES" end if if request.querystring("action") = "delete" then SQL = "select owner, registered from randomquotes where quoteid=" & BBS.ValidateNumeric(request.querystring("id")) rsMaster.open SQL, dbConnection, adOpenForwardonly, adlockreadonly BBS.AddQuery(SQL) if not rsMaster.eof then if ucase(rsmaster.fields("owner").value) = ucase(sBBSUsername) or bIsModerator then ' Go ahead and delete the quote SQL = "delete from randomquotes where quoteid=" & BBS.ValidateNumeric(request.querystring("id")) dbConnection.execute SQL BBS.AddQuery(SQL) end if end if rsmaster.close BBS.CacheDelete "RANDOMQUOTES" end if ' Get a list of random quotes SQL = "select quoteid, message, owner, registered from randomquotes order by quoteid asc" rsMaster.open SQL, dbConnection, adopenforwardonly, adlockreadonly BBS.AddQuery(SQL) if not(rsMaster.EOF) then vArray = rsMaster.GetRows iUpper = ubound(vArray, 2) else iUpper = -1 end if rsMaster.Close for index=0 to iUpper if vArray(3, index) = 1 then vbString.Append "