mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +00:00
Ability to search bans by bantype
This commit is contained in:
@@ -263,7 +263,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
|||||||
holder.DB_ban_panel()
|
holder.DB_ban_panel()
|
||||||
|
|
||||||
|
|
||||||
/datum/admins/proc/DB_ban_panel(var/playerckey = null, var/adminckey = null, var/playerip = null, var/playercid = null, var/match = null)
|
/datum/admins/proc/DB_ban_panel(var/playerckey = null, var/adminckey = null, var/playerip = null, var/playercid = null, var/dbbantype = null, var/match = null)
|
||||||
if(!usr.client)
|
if(!usr.client)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -318,13 +318,28 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
|||||||
output += "<tr><td width='50%' align='right'><b>Ckey:</b> <input type='text' name='dbsearchckey' value='[playerckey]'></td>"
|
output += "<tr><td width='50%' align='right'><b>Ckey:</b> <input type='text' name='dbsearchckey' value='[playerckey]'></td>"
|
||||||
output += "<td width='50%' align='right'><b>Admin ckey:</b> <input type='text' name='dbsearchadmin' value='[adminckey]'></td></tr>"
|
output += "<td width='50%' align='right'><b>Admin ckey:</b> <input type='text' name='dbsearchadmin' value='[adminckey]'></td></tr>"
|
||||||
output += "<tr><td width='50%' align='right'><b>IP:</b> <input type='text' name='dbsearchip' value='[playerip]'></td>"
|
output += "<tr><td width='50%' align='right'><b>IP:</b> <input type='text' name='dbsearchip' value='[playerip]'></td>"
|
||||||
output += "<td width='50%' align='right'><b>CID:</b> <input type='text' name='dbsearchcid' value='[playercid]'></td></tr></table>"
|
output += "<td width='50%' align='right'><b>CID:</b> <input type='text' name='dbsearchcid' value='[playercid]'></td></tr>"
|
||||||
|
output += "<tr><td width='50%' align='right' colspan='2'><b>Ban type:</b><select name='dbsearchbantype'>"
|
||||||
|
output += "<option value=''>--</option>"
|
||||||
|
output += "<option value='[BANTYPE_PERMA]'>PERMABAN</option>"
|
||||||
|
output += "<option value='[BANTYPE_TEMP]'>TEMPBAN</option>"
|
||||||
|
output += "<option value='[BANTYPE_JOB_PERMA]'>JOB PERMABAN</option>"
|
||||||
|
output += "<option value='[BANTYPE_JOB_TEMP]'>JOB TEMPBAN</option>"
|
||||||
|
output += "</select></td></tr></table>"
|
||||||
output += "<br><input type='submit' value='search'><br>"
|
output += "<br><input type='submit' value='search'><br>"
|
||||||
output += "<input type='checkbox' value='[match]' name='dbmatch' [match? "checked=\"1\"" : null]> Match(min. 3 characters to search)<br>"
|
output += "<input type='checkbox' value='[match]' name='dbmatch' [match? "checked=\"1\"" : null]> Match(min. 3 characters to search by key or ip, and 7 to search by cid)<br>"
|
||||||
output += "</form>"
|
output += "</form>"
|
||||||
output += "Please note that all jobban bans or unbans are in-effect the following round."
|
output += "Please note that all jobban bans or unbans are in-effect the following round.<br>"
|
||||||
|
output += "This search shows only last 100 bans."
|
||||||
|
|
||||||
if(adminckey || playerckey || playerip || playercid)
|
if(adminckey || playerckey || playerip || playercid || dbbantype)
|
||||||
|
|
||||||
|
adminckey = ckey(adminckey)
|
||||||
|
playerckey = ckey(playerckey)
|
||||||
|
playerip = sql_sanitize_text(playerip)
|
||||||
|
playercid = sql_sanitize_text(playercid)
|
||||||
|
|
||||||
|
if(adminckey || playerckey || playerip || playercid || dbbantype)
|
||||||
|
|
||||||
var/blcolor = "#ffeeee" //banned light
|
var/blcolor = "#ffeeee" //banned light
|
||||||
var/bdcolor = "#ffdddd" //banned dark
|
var/bdcolor = "#ffdddd" //banned dark
|
||||||
@@ -340,15 +355,12 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
|||||||
output += "<th width='15%'><b>OPTIONS</b></th>"
|
output += "<th width='15%'><b>OPTIONS</b></th>"
|
||||||
output += "</tr>"
|
output += "</tr>"
|
||||||
|
|
||||||
adminckey = ckey(adminckey)
|
|
||||||
playerckey = ckey(playerckey)
|
|
||||||
playerip = sql_sanitize_text(playerip)
|
|
||||||
playercid = sql_sanitize_text(playercid)
|
|
||||||
|
|
||||||
var/adminsearch = ""
|
var/adminsearch = ""
|
||||||
var/playersearch = ""
|
var/playersearch = ""
|
||||||
var/ipsearch = ""
|
var/ipsearch = ""
|
||||||
var/cidsearch = ""
|
var/cidsearch = ""
|
||||||
|
var/bantypesearch = ""
|
||||||
|
|
||||||
if(!match)
|
if(!match)
|
||||||
if(adminckey)
|
if(adminckey)
|
||||||
adminsearch = "AND a_ckey = '[adminckey]' "
|
adminsearch = "AND a_ckey = '[adminckey]' "
|
||||||
@@ -365,10 +377,23 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
|||||||
playersearch = "AND ckey LIKE '[playerckey]%' "
|
playersearch = "AND ckey LIKE '[playerckey]%' "
|
||||||
if(playerip && lentext(playerip) > 3)
|
if(playerip && lentext(playerip) > 3)
|
||||||
ipsearch = "AND ip LIKE '[playerip]%' "
|
ipsearch = "AND ip LIKE '[playerip]%' "
|
||||||
if(playercid && lentext(playercid) > 3)
|
if(playercid && lentext(playercid) > 7)
|
||||||
cidsearch = "AND computerid LIKE '[playercid]%' "
|
cidsearch = "AND computerid LIKE '[playercid]%' "
|
||||||
|
|
||||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, edits, ip, computerid FROM erro_ban WHERE 1 [playersearch] [adminsearch] [ipsearch] [cidsearch] ORDER BY bantime DESC")
|
if(dbbantype)
|
||||||
|
bantypesearch = "AND bantype = "
|
||||||
|
|
||||||
|
switch(dbbantype)
|
||||||
|
if(BANTYPE_TEMP)
|
||||||
|
bantypesearch += "'TEMPBAN' "
|
||||||
|
if(BANTYPE_JOB_PERMA)
|
||||||
|
bantypesearch += "'JOB_PERMABAN' "
|
||||||
|
if(BANTYPE_JOB_TEMP)
|
||||||
|
bantypesearch += "'JOB_TEMPBAN' "
|
||||||
|
else
|
||||||
|
bantypesearch += "'PERMABAN' "
|
||||||
|
|
||||||
|
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, edits, ip, computerid FROM erro_ban WHERE 1 [playersearch] [adminsearch] [ipsearch] [cidsearch] [bantypesearch] ORDER BY bantime DESC LIMIT 100")
|
||||||
select_query.Execute()
|
select_query.Execute()
|
||||||
|
|
||||||
while(select_query.NextRow())
|
while(select_query.NextRow())
|
||||||
|
|||||||
@@ -52,16 +52,18 @@
|
|||||||
log_admin("[key_name(usr)] has spawned vox raiders.")
|
log_admin("[key_name(usr)] has spawned vox raiders.")
|
||||||
if(!src.makeVoxRaiders())
|
if(!src.makeVoxRaiders())
|
||||||
usr << "\red Unfortunately there weren't enough candidates available."
|
usr << "\red Unfortunately there weren't enough candidates available."
|
||||||
else if(href_list["dbsearchckey"] || href_list["dbsearchadmin"] || href_list["dbsearchip"] || href_list["dbsearchcid"])
|
else if(href_list["dbsearchckey"] || href_list["dbsearchadmin"] || href_list["dbsearchip"] || href_list["dbsearchcid"] || href_list["dbsearchbantype"])
|
||||||
var/adminckey = href_list["dbsearchadmin"]
|
var/adminckey = href_list["dbsearchadmin"]
|
||||||
var/playerckey = href_list["dbsearchckey"]
|
var/playerckey = href_list["dbsearchckey"]
|
||||||
var/playerip = href_list["dbsearchip"]
|
var/playerip = href_list["dbsearchip"]
|
||||||
var/playercid = href_list["dbsearchcid"]
|
var/playercid = href_list["dbsearchcid"]
|
||||||
|
var/dbbantype = text2num(href_list["dbsearchbantype"])
|
||||||
var/match = 0
|
var/match = 0
|
||||||
|
|
||||||
if("dbmatch" in href_list)
|
if("dbmatch" in href_list)
|
||||||
match = 1
|
match = 1
|
||||||
|
|
||||||
DB_ban_panel(playerckey, adminckey, playerip, playercid, match)
|
DB_ban_panel(playerckey, adminckey, playerip, playercid, dbbantype, match)
|
||||||
return
|
return
|
||||||
|
|
||||||
else if(href_list["dbbanedit"])
|
else if(href_list["dbbanedit"])
|
||||||
|
|||||||
Reference in New Issue
Block a user