mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Ban refactor part 2/3 - Kills off savefile bans (#17135)
This commit is contained in:
+14
-100
@@ -425,71 +425,13 @@
|
||||
log_admin("[key_name(usr)] has used rudimentary transformation on [key_name(M)]. Transforming to [href_list["simplemake"]]; deletemob=[delmob]")
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] has used rudimentary transformation on [key_name_admin(M)]. Transforming to [href_list["simplemake"]]; deletemob=[delmob]</span>", 1)
|
||||
|
||||
|
||||
/////////////////////////////////////new ban stuff
|
||||
else if(href_list["unbanf"])
|
||||
if(!check_rights(R_BAN)) return
|
||||
|
||||
var/banfolder = href_list["unbanf"]
|
||||
GLOB.banlist_savefile.cd = "/base/[banfolder]"
|
||||
var/key = GLOB.banlist_savefile["key"]
|
||||
if(alert(usr, "Are you sure you want to unban [key]?", "Confirmation", "Yes", "No") == "Yes")
|
||||
if(RemoveBan(banfolder))
|
||||
unbanpanel()
|
||||
else
|
||||
alert(usr, "This ban has already been lifted / does not exist.", "Error", "Ok")
|
||||
unbanpanel()
|
||||
|
||||
else if(href_list["unbane"])
|
||||
if(!check_rights(R_BAN)) return
|
||||
|
||||
UpdateTime()
|
||||
var/reason
|
||||
|
||||
var/banfolder = href_list["unbane"]
|
||||
GLOB.banlist_savefile.cd = "/base/[banfolder]"
|
||||
var/reason2 = GLOB.banlist_savefile["reason"]
|
||||
var/temp = GLOB.banlist_savefile["temp"]
|
||||
|
||||
var/minutes = GLOB.banlist_savefile["minutes"]
|
||||
|
||||
var/banned_key = GLOB.banlist_savefile["key"]
|
||||
GLOB.banlist_savefile.cd = "/base"
|
||||
|
||||
var/duration
|
||||
|
||||
switch(alert("Temporary Ban?",,"Yes","No"))
|
||||
if("Yes")
|
||||
temp = 1
|
||||
var/mins = 0
|
||||
if(minutes > GLOB.CMinutes)
|
||||
mins = minutes - GLOB.CMinutes
|
||||
mins = input(usr,"How long (in minutes)? (Default: 1440)","Ban time",mins ? mins : 1440) as num|null
|
||||
if(!mins) return
|
||||
mins = min(525599,mins)
|
||||
minutes = GLOB.CMinutes + mins
|
||||
duration = GetExp(minutes)
|
||||
reason = input(usr,"Please state the reason","Reason",reason2) as message|null
|
||||
if(!reason) return
|
||||
if("No")
|
||||
temp = 0
|
||||
duration = "Perma"
|
||||
reason = input(usr,"Please state the reason","Reason",reason2) as message|null
|
||||
if(!reason) return
|
||||
|
||||
log_admin("[key_name(usr)] edited [banned_key]'s ban. Reason: [reason] Duration: [duration]")
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] edited [banned_key]'s ban. Reason: [reason] Duration: [duration]</span>", 1)
|
||||
GLOB.banlist_savefile.cd = "/base/[banfolder]"
|
||||
to_chat(GLOB.banlist_savefile["reason"], reason)
|
||||
to_chat(GLOB.banlist_savefile["temp"], temp)
|
||||
to_chat(GLOB.banlist_savefile["minutes"], minutes)
|
||||
to_chat(GLOB.banlist_savefile["bannedby"], usr.ckey)
|
||||
GLOB.banlist_savefile.cd = "/base"
|
||||
unbanpanel()
|
||||
|
||||
else if(href_list["jobban2"])
|
||||
// if(!check_rights(R_BAN)) return
|
||||
|
||||
if(!SSdbcore.IsConnected())
|
||||
alert(usr, "Job bans require the datbase to be setup.", "Error", "Ok")
|
||||
return
|
||||
|
||||
var/mob/M = locateUID(href_list["jobban2"])
|
||||
if(!istype(M, /mob))
|
||||
to_chat(usr, "<span class='warning'>This can only be used on instances of type /mob</span>")
|
||||
@@ -507,11 +449,11 @@
|
||||
var/body
|
||||
var/jobs = ""
|
||||
|
||||
/***********************************WARNING!************************************
|
||||
The jobban stuff looks mangled and disgusting
|
||||
But it looks beautiful in-game
|
||||
-Nodrak
|
||||
************************************WARNING!***********************************/
|
||||
/***********************************WARNING!************************************
|
||||
The jobban stuff looks mangled and disgusting
|
||||
But it looks beautiful in-game
|
||||
-Nodrak
|
||||
************************************WARNING!***********************************/
|
||||
var/counter = 0
|
||||
//Regular jobs
|
||||
//Command (Blue)
|
||||
@@ -691,7 +633,7 @@
|
||||
counter = 0
|
||||
jobs += "</tr></table>"
|
||||
|
||||
//Other races (BLUE, because I have no idea what other color to make this)
|
||||
//Other races (BLUE, because I have no idea what other color to make this)
|
||||
jobs += "<table cellpadding='1' cellspacing='0' width='100%'>"
|
||||
jobs += "<tr bgcolor='ccccff'><th colspan='10'>Other</th></tr><tr align='center'>"
|
||||
|
||||
@@ -819,9 +761,6 @@
|
||||
if(notbannedlist.len) //at least 1 unbanned job exists in joblist so we have stuff to ban.
|
||||
switch(alert("Temporary Ban of [M.ckey]?",,"Yes","No", "Cancel"))
|
||||
if("Yes")
|
||||
if(!GLOB.configuration.general.use_database_bans)
|
||||
to_chat(usr, "<span class='warning'>Your server is using the legacy banning system, which does not support temporary job bans. Consider upgrading. Aborting ban.</span>")
|
||||
return
|
||||
var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null
|
||||
if(!mins)
|
||||
return
|
||||
@@ -867,33 +806,6 @@
|
||||
if("Cancel")
|
||||
return
|
||||
|
||||
//Unbanning joblist
|
||||
//all jobs in joblist are banned already OR we didn't give a reason (implying they shouldn't be banned)
|
||||
if(joblist.len) //at least 1 banned job exists in joblist so we have stuff to unban.
|
||||
if(GLOB.configuration.general.use_database_bans)
|
||||
to_chat(usr, "<span class='warning'>Unfortunately, database based unbanning cannot be done through this panel</span>")
|
||||
DB_ban_panel(M.ckey)
|
||||
return
|
||||
var/msg
|
||||
for(var/job in joblist)
|
||||
var/reason = jobban_isbanned(M, job)
|
||||
if(!reason) continue //skip if it isn't jobbanned anyway
|
||||
switch(alert("Job: '[job]' Reason: '[reason]' Un-jobban?","Please Confirm","Yes","No"))
|
||||
if("Yes")
|
||||
log_admin("[key_name(usr)] unbanned [key_name(M)] from [job]")
|
||||
DB_ban_unban(M.ckey, BANTYPE_JOB_PERMA, job)
|
||||
jobban_unban(M, job)
|
||||
if(!msg) msg = job
|
||||
else msg += ", [job]"
|
||||
else
|
||||
continue
|
||||
if(msg)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] unbanned [key_name_admin(M)] from [msg]</span>", 1)
|
||||
to_chat(M, "<span class='warning'><big><b>You have been un-jobbanned by [usr.client.ckey] from [msg].</b></big></span>")
|
||||
href_list["jobban2"] = 1 // lets it fall through and refresh
|
||||
return 1
|
||||
return 0 //we didn't do anything!
|
||||
|
||||
else if(href_list["boot2"])
|
||||
var/mob/M = locateUID(href_list["boot2"])
|
||||
if(!ismob(M))
|
||||
@@ -989,6 +901,10 @@
|
||||
else if(href_list["newban"])
|
||||
if(!check_rights(R_BAN)) return
|
||||
|
||||
if(!SSdbcore.IsConnected())
|
||||
alert(usr, "Bans require the database to be connected.<br>If this is a local server, please ban from within Dream Daemon.", "Error", "Ok")
|
||||
return
|
||||
|
||||
var/mob/M = locateUID(href_list["newban"])
|
||||
if(!istype(M, /mob))
|
||||
return
|
||||
@@ -1004,7 +920,6 @@
|
||||
if(!reason)
|
||||
return
|
||||
M = admin_ban_mobsearch(M, ban_ckey_param, usr)
|
||||
AddBan(M.ckey, M.computer_id, reason, usr.ckey, 1, mins)
|
||||
to_chat(M, "<span class='warning'><big><b>You have been banned by [usr.client.ckey].\nReason: [reason].</b></big></span>")
|
||||
to_chat(M, "<span class='warning'>This is a temporary ban, it will be removed in [mins] minutes.</span>")
|
||||
DB_ban_record(BANTYPE_TEMP, M, mins, reason)
|
||||
@@ -1022,7 +937,6 @@
|
||||
var/reason = input(usr,"Please state the reason","Reason") as message|null
|
||||
if(!reason)
|
||||
return
|
||||
AddBan(M.ckey, M.computer_id, reason, usr.ckey, 0, 0, M.lastKnownIP)
|
||||
to_chat(M, "<span class='warning'><big><b>You have been banned by [usr.client.ckey].\nReason: [reason].</b></big></span>")
|
||||
to_chat(M, "<span class='warning'>This ban does not expire automatically and must be appealed.</span>")
|
||||
if(M.client)
|
||||
|
||||
Reference in New Issue
Block a user