mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +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()
|
||||
|
||||
|
||||
/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)
|
||||
return
|
||||
|
||||
@@ -318,122 +318,147 @@ 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 += "<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 += "<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 += "<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 += "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)
|
||||
|
||||
var/blcolor = "#ffeeee" //banned light
|
||||
var/bdcolor = "#ffdddd" //banned dark
|
||||
var/ulcolor = "#eeffee" //unbanned light
|
||||
var/udcolor = "#ddffdd" //unbanned dark
|
||||
|
||||
output += "<table width='90%' bgcolor='#e3e3e3' cellpadding='5' cellspacing='0' align='center'>"
|
||||
output += "<tr>"
|
||||
output += "<th width='25%'><b>TYPE</b></th>"
|
||||
output += "<th width='20%'><b>CKEY</b></th>"
|
||||
output += "<th width='20%'><b>TIME APPLIED</b></th>"
|
||||
output += "<th width='20%'><b>ADMIN</b></th>"
|
||||
output += "<th width='15%'><b>OPTIONS</b></th>"
|
||||
output += "</tr>"
|
||||
if(adminckey || playerckey || playerip || playercid || dbbantype)
|
||||
|
||||
adminckey = ckey(adminckey)
|
||||
playerckey = ckey(playerckey)
|
||||
playerip = sql_sanitize_text(playerip)
|
||||
playercid = sql_sanitize_text(playercid)
|
||||
|
||||
var/adminsearch = ""
|
||||
var/playersearch = ""
|
||||
var/ipsearch = ""
|
||||
var/cidsearch = ""
|
||||
if(!match)
|
||||
if(adminckey)
|
||||
adminsearch = "AND a_ckey = '[adminckey]' "
|
||||
if(playerckey)
|
||||
playersearch = "AND ckey = '[playerckey]' "
|
||||
if(playerip)
|
||||
ipsearch = "AND ip = '[playerip]' "
|
||||
if(playercid)
|
||||
cidsearch = "AND computerid = '[playercid]' "
|
||||
else
|
||||
if(adminckey && lentext(adminckey) > 3)
|
||||
adminsearch = "AND a_ckey LIKE '[adminckey]%' "
|
||||
if(playerckey && lentext(playerckey) > 3)
|
||||
playersearch = "AND ckey LIKE '[playerckey]%' "
|
||||
if(playerip && lentext(playerip) > 3)
|
||||
ipsearch = "AND ip LIKE '[playerip]%' "
|
||||
if(playercid && lentext(playercid) > 3)
|
||||
cidsearch = "AND computerid LIKE '[playercid]%' "
|
||||
if(adminckey || playerckey || playerip || playercid || dbbantype)
|
||||
|
||||
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")
|
||||
select_query.Execute()
|
||||
var/blcolor = "#ffeeee" //banned light
|
||||
var/bdcolor = "#ffdddd" //banned dark
|
||||
var/ulcolor = "#eeffee" //unbanned light
|
||||
var/udcolor = "#ddffdd" //unbanned dark
|
||||
|
||||
while(select_query.NextRow())
|
||||
var/banid = select_query.item[1]
|
||||
var/bantime = select_query.item[2]
|
||||
var/bantype = select_query.item[3]
|
||||
var/reason = select_query.item[4]
|
||||
var/job = select_query.item[5]
|
||||
var/duration = select_query.item[6]
|
||||
var/expiration = select_query.item[7]
|
||||
var/ckey = select_query.item[8]
|
||||
var/ackey = select_query.item[9]
|
||||
var/unbanned = select_query.item[10]
|
||||
var/unbanckey = select_query.item[11]
|
||||
var/unbantime = select_query.item[12]
|
||||
var/edits = select_query.item[13]
|
||||
var/ip = select_query.item[14]
|
||||
var/cid = select_query.item[15]
|
||||
|
||||
var/lcolor = blcolor
|
||||
var/dcolor = bdcolor
|
||||
if(unbanned)
|
||||
lcolor = ulcolor
|
||||
dcolor = udcolor
|
||||
|
||||
var/typedesc =""
|
||||
switch(bantype)
|
||||
if("PERMABAN")
|
||||
typedesc = "<font color='red'><b>PERMABAN</b></font>"
|
||||
if("TEMPBAN")
|
||||
typedesc = "<b>TEMPBAN</b><br><font size='2'>([duration] minutes [(unbanned) ? "" : "(<a href=\"byond://?src=\ref[src];dbbanedit=duration;dbbanid=[banid]\">Edit</a>))"]<br>Expires [expiration]</font>"
|
||||
if("JOB_PERMABAN")
|
||||
typedesc = "<b>JOBBAN</b><br><font size='2'>([job])"
|
||||
if("JOB_TEMPBAN")
|
||||
typedesc = "<b>TEMP JOBBAN</b><br><font size='2'>([job])<br>([duration] minutes<br>Expires [expiration]"
|
||||
|
||||
output += "<tr bgcolor='[dcolor]'>"
|
||||
output += "<td align='center'>[typedesc]</td>"
|
||||
output += "<td align='center'><b>[ckey]</b></td>"
|
||||
output += "<td align='center'>[bantime]</td>"
|
||||
output += "<td align='center'><b>[ackey]</b></td>"
|
||||
output += "<td align='center'>[(unbanned) ? "" : "<b><a href=\"byond://?src=\ref[src];dbbanedit=unban;dbbanid=[banid]\">Unban</a></b>"]</td>"
|
||||
output += "<table width='90%' bgcolor='#e3e3e3' cellpadding='5' cellspacing='0' align='center'>"
|
||||
output += "<tr>"
|
||||
output += "<th width='25%'><b>TYPE</b></th>"
|
||||
output += "<th width='20%'><b>CKEY</b></th>"
|
||||
output += "<th width='20%'><b>TIME APPLIED</b></th>"
|
||||
output += "<th width='20%'><b>ADMIN</b></th>"
|
||||
output += "<th width='15%'><b>OPTIONS</b></th>"
|
||||
output += "</tr>"
|
||||
output += "<tr bgcolor='[dcolor]'>"
|
||||
output += "<td align='center' colspan='2' bgcolor=''><b>IP:</b> [ip]</td>"
|
||||
output += "<td align='center' colspan='3' bgcolor=''><b>CIP:</b> [cid]</td>"
|
||||
output += "</tr>"
|
||||
output += "<tr bgcolor='[lcolor]'>"
|
||||
output += "<td align='center' colspan='5'><b>Reason: [(unbanned) ? "" : "(<a href=\"byond://?src=\ref[src];dbbanedit=reason;dbbanid=[banid]\">Edit</a>)"]</b> <cite>\"[reason]\"</cite></td>"
|
||||
output += "</tr>"
|
||||
if(edits)
|
||||
|
||||
var/adminsearch = ""
|
||||
var/playersearch = ""
|
||||
var/ipsearch = ""
|
||||
var/cidsearch = ""
|
||||
var/bantypesearch = ""
|
||||
|
||||
if(!match)
|
||||
if(adminckey)
|
||||
adminsearch = "AND a_ckey = '[adminckey]' "
|
||||
if(playerckey)
|
||||
playersearch = "AND ckey = '[playerckey]' "
|
||||
if(playerip)
|
||||
ipsearch = "AND ip = '[playerip]' "
|
||||
if(playercid)
|
||||
cidsearch = "AND computerid = '[playercid]' "
|
||||
else
|
||||
if(adminckey && lentext(adminckey) > 3)
|
||||
adminsearch = "AND a_ckey LIKE '[adminckey]%' "
|
||||
if(playerckey && lentext(playerckey) > 3)
|
||||
playersearch = "AND ckey LIKE '[playerckey]%' "
|
||||
if(playerip && lentext(playerip) > 3)
|
||||
ipsearch = "AND ip LIKE '[playerip]%' "
|
||||
if(playercid && lentext(playercid) > 7)
|
||||
cidsearch = "AND computerid LIKE '[playercid]%' "
|
||||
|
||||
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()
|
||||
|
||||
while(select_query.NextRow())
|
||||
var/banid = select_query.item[1]
|
||||
var/bantime = select_query.item[2]
|
||||
var/bantype = select_query.item[3]
|
||||
var/reason = select_query.item[4]
|
||||
var/job = select_query.item[5]
|
||||
var/duration = select_query.item[6]
|
||||
var/expiration = select_query.item[7]
|
||||
var/ckey = select_query.item[8]
|
||||
var/ackey = select_query.item[9]
|
||||
var/unbanned = select_query.item[10]
|
||||
var/unbanckey = select_query.item[11]
|
||||
var/unbantime = select_query.item[12]
|
||||
var/edits = select_query.item[13]
|
||||
var/ip = select_query.item[14]
|
||||
var/cid = select_query.item[15]
|
||||
|
||||
var/lcolor = blcolor
|
||||
var/dcolor = bdcolor
|
||||
if(unbanned)
|
||||
lcolor = ulcolor
|
||||
dcolor = udcolor
|
||||
|
||||
var/typedesc =""
|
||||
switch(bantype)
|
||||
if("PERMABAN")
|
||||
typedesc = "<font color='red'><b>PERMABAN</b></font>"
|
||||
if("TEMPBAN")
|
||||
typedesc = "<b>TEMPBAN</b><br><font size='2'>([duration] minutes [(unbanned) ? "" : "(<a href=\"byond://?src=\ref[src];dbbanedit=duration;dbbanid=[banid]\">Edit</a>))"]<br>Expires [expiration]</font>"
|
||||
if("JOB_PERMABAN")
|
||||
typedesc = "<b>JOBBAN</b><br><font size='2'>([job])"
|
||||
if("JOB_TEMPBAN")
|
||||
typedesc = "<b>TEMP JOBBAN</b><br><font size='2'>([job])<br>([duration] minutes<br>Expires [expiration]"
|
||||
|
||||
output += "<tr bgcolor='[dcolor]'>"
|
||||
output += "<td align='center' colspan='5'><b>EDITS</b></td>"
|
||||
output += "<td align='center'>[typedesc]</td>"
|
||||
output += "<td align='center'><b>[ckey]</b></td>"
|
||||
output += "<td align='center'>[bantime]</td>"
|
||||
output += "<td align='center'><b>[ackey]</b></td>"
|
||||
output += "<td align='center'>[(unbanned) ? "" : "<b><a href=\"byond://?src=\ref[src];dbbanedit=unban;dbbanid=[banid]\">Unban</a></b>"]</td>"
|
||||
output += "</tr>"
|
||||
output += "<tr bgcolor='[dcolor]'>"
|
||||
output += "<td align='center' colspan='2' bgcolor=''><b>IP:</b> [ip]</td>"
|
||||
output += "<td align='center' colspan='3' bgcolor=''><b>CIP:</b> [cid]</td>"
|
||||
output += "</tr>"
|
||||
output += "<tr bgcolor='[lcolor]'>"
|
||||
output += "<td align='center' colspan='5'><font size='2'>[edits]</font></td>"
|
||||
output += "<td align='center' colspan='5'><b>Reason: [(unbanned) ? "" : "(<a href=\"byond://?src=\ref[src];dbbanedit=reason;dbbanid=[banid]\">Edit</a>)"]</b> <cite>\"[reason]\"</cite></td>"
|
||||
output += "</tr>"
|
||||
if(unbanned)
|
||||
output += "<tr bgcolor='[dcolor]'>"
|
||||
output += "<td align='center' colspan='5' bgcolor=''><b>UNBANNED by admin [unbanckey] on [unbantime]</b></td>"
|
||||
if(edits)
|
||||
output += "<tr bgcolor='[dcolor]'>"
|
||||
output += "<td align='center' colspan='5'><b>EDITS</b></td>"
|
||||
output += "</tr>"
|
||||
output += "<tr bgcolor='[lcolor]'>"
|
||||
output += "<td align='center' colspan='5'><font size='2'>[edits]</font></td>"
|
||||
output += "</tr>"
|
||||
if(unbanned)
|
||||
output += "<tr bgcolor='[dcolor]'>"
|
||||
output += "<td align='center' colspan='5' bgcolor=''><b>UNBANNED by admin [unbanckey] on [unbantime]</b></td>"
|
||||
output += "</tr>"
|
||||
output += "<tr>"
|
||||
output += "<td colspan='5' bgcolor='white'> </td>"
|
||||
output += "</tr>"
|
||||
output += "<tr>"
|
||||
output += "<td colspan='5' bgcolor='white'> </td>"
|
||||
output += "</tr>"
|
||||
|
||||
output += "</table></div>"
|
||||
output += "</table></div>"
|
||||
|
||||
usr << browse(output,"window=lookupbans;size=900x700")
|
||||
@@ -52,16 +52,18 @@
|
||||
log_admin("[key_name(usr)] has spawned vox raiders.")
|
||||
if(!src.makeVoxRaiders())
|
||||
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/playerckey = href_list["dbsearchckey"]
|
||||
var/playerip = href_list["dbsearchip"]
|
||||
var/playercid = href_list["dbsearchcid"]
|
||||
var/dbbantype = text2num(href_list["dbsearchbantype"])
|
||||
var/match = 0
|
||||
|
||||
if("dbmatch" in href_list)
|
||||
match = 1
|
||||
|
||||
DB_ban_panel(playerckey, adminckey, playerip, playercid, match)
|
||||
DB_ban_panel(playerckey, adminckey, playerip, playercid, dbbantype, match)
|
||||
return
|
||||
|
||||
else if(href_list["dbbanedit"])
|
||||
|
||||
Reference in New Issue
Block a user