From f0cdd841da6c8ad99e46c2af6e69b92ce59fe9c4 Mon Sep 17 00:00:00 2001 From: Jordie <4343468+Jordie0608@users.noreply.github.com> Date: Tue, 1 Jan 2019 22:31:42 +1100 Subject: [PATCH] Ban editing and logging fixes (#42148) Fixes #42146 Fixes ban created notes being double escaped. Fixes admin tickets not being resolved for a disconnected client when banned. Re-adds ban reason to admin log for a ban as requested --- code/modules/admin/sql_ban_system.dm | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/code/modules/admin/sql_ban_system.dm b/code/modules/admin/sql_ban_system.dm index e5648cc92d9..12e9e040599 100644 --- a/code/modules/admin/sql_ban_system.dm +++ b/code/modules/admin/sql_ban_system.dm @@ -425,6 +425,10 @@ interval = sanitizeSQL(interval) else interval = "MINUTE" + var/time_message = "[duration] [lowertext(interval)]" //no DisplayTimeText because our duration is of variable interval type + if(duration > 1) //pluralize the interval if necessary + time_message += "s" + var/note_reason = "Banned from [roles_to_ban[1] == "Server" ? "the server" : " Roles: [roles_to_ban.Join(", ")]"] [isnull(duration) ? "permanently" : "for [time_message]"] - [reason]" reason = sanitizeSQL(reason) var/list/clients_online = GLOB.clients.Copy() var/list/admins_online = list() @@ -456,15 +460,11 @@ )) if(!SSdbcore.MassInsert(format_table_name("ban"), sql_ban, warn = 1)) return - var/time_message = "[duration] [lowertext(interval)]" //no DisplayTimeText because our duration is of variable interval type - if(duration > 1) //pluralize the interval if necessary - time_message += "s" var/msg = "has created a [isnull(duration) ? "permanent" : "temporary [time_message]"] [applies_to_admins ? "admin " : ""][roles_to_ban[1] == "Server" ? "server ban" : "role ban from [roles_to_ban.len] roles"] for [player_key]." - log_admin_private("[kn] [msg][roles_to_ban[1] == "Server" ? "" : " Roles: [roles_to_ban.Join(", ")]"]") - message_admins("[kna] [msg][roles_to_ban[1] == "Server" ? "" : " Roles: [roles_to_ban.Join("\n")]"]") + log_admin_private("[kn] [msg][roles_to_ban[1] == "Server" ? "" : " Roles: [roles_to_ban.Join(", ")]"] Reason: [reason]") + message_admins("[kna] [msg][roles_to_ban[1] == "Server" ? "" : " Roles: [roles_to_ban.Join("\n")]"]\nReason: [reason]") if(applies_to_admins) send2irc("BAN ALERT","[kn] [msg]") - var/note_reason = "Banned from [roles_to_ban[1] == "Server" ? "the server" : " Roles: [roles_to_ban.Join(", ")]"] [isnull(duration) ? "permanently" : "for [time_message]"] - [reason]" create_message("note", player_ckey, admin_ckey, note_reason, null, null, 0, 0, null, 0, severity) var/client/C = GLOB.directory[player_ckey] var/datum/admin_help/AH = admin_ticket_log(player_ckey, msg) @@ -473,10 +473,9 @@ if(C) build_ban_cache(C) to_chat(C, "You have been [applies_to_admins ? "admin " : ""]banned by [usr.client.key] from [roles_to_ban[1] == "Server" ? "the server" : " Roles: [roles_to_ban.Join(", ")]"].\nReason: [reason]
This ban is [isnull(duration) ? "permanent." : "temporary, it will be removed in [time_message]."] The round ID is [GLOB.round_id].
To appeal this ban go to [appeal_url]") - if(roles_to_ban[1] == "Server") - if(AH) - AH.Resolve() - qdel(C) + qdel(C) + if(roles_to_ban[1] == "Server" && AH) + AH.Resolve() for(var/client/i in GLOB.clients - C) if(i.address == player_ip || i.computer_id == player_cid) build_ban_cache(i) @@ -664,7 +663,7 @@ var/list/changes_text= list() var/list/changes_keys = list() for(var/i in changes) - changes_text += "[i]: [changes[i]]" + changes_text += "[sanitizeSQL(i)]: [sanitizeSQL(changes[i])]" changes_keys += i var/where = "id = [sanitizeSQL(ban_id)]" if(text2num(mirror_edit))