mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 06:29:23 +01:00
[MIRROR] Fix long ban reasons breaking rolebans [MDB IGNORE] (#9169)
* Fix long ban reasons breaking rolebans (#62408) Fixes long ban reasons breaking rolebans by adding a max length to the ban reason and making sure that the roleban_delimiter is present on a roleban. * Fix long ban reasons breaking rolebans Co-authored-by: adamsong <adamsong@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#define MAX_ADMINBANS_PER_ADMIN 1
|
||||
#define MAX_ADMINBANS_PER_HEADMIN 3
|
||||
|
||||
#define MAX_REASON_LENGTH 600
|
||||
|
||||
//checks client ban cache or DB ban table if ckey is banned from one or more roles
|
||||
//doesn't return any details, use only for if statements
|
||||
/proc/is_banned_from(player_ckey, list/roles)
|
||||
@@ -232,7 +234,7 @@
|
||||
<div class='column'>
|
||||
Reason
|
||||
<br>
|
||||
<textarea class='reason' name='reason'>[reason]</textarea>
|
||||
<textarea class='reason' name='reason' maxlength='[MAX_REASON_LENGTH]'>[reason]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
"}
|
||||
@@ -459,6 +461,8 @@
|
||||
reason = href_list["reason"]
|
||||
if(!reason)
|
||||
error_state += "No reason was provided."
|
||||
if(length(reason) > MAX_REASON_LENGTH)
|
||||
error_state += "Reason cannot be more than [MAX_REASON_LENGTH] characters."
|
||||
if(href_list["editid"])
|
||||
edit_id = href_list["editid"]
|
||||
if(href_list["mirroredit"])
|
||||
@@ -496,10 +500,12 @@
|
||||
roles_to_ban += "Server"
|
||||
if("role")
|
||||
href_list.Remove("Command", "Security", "Engineering", "Medical", "Science", "Supply", "Silicon", "Abstract", "Service", "Ghost and Other Roles", "Antagonist Positions") //remove the role banner hidden input values
|
||||
if(href_list[href_list.len] == "roleban_delimiter")
|
||||
var/delimiter_pos = href_list.Find("roleban_delimiter")
|
||||
if(href_list.len == delimiter_pos)
|
||||
error_state += "Role ban was selected but no roles to ban were selected."
|
||||
else if(delimiter_pos == 0)
|
||||
error_state += "roleban_delimiter not found in href. Report this to coders."
|
||||
else
|
||||
var/delimiter_pos = href_list.Find("roleban_delimiter")
|
||||
href_list.Cut(1, delimiter_pos+1)//remove every list element before and including roleban_delimiter so we have a list of only the roles to ban
|
||||
for(var/key in href_list) //flatten into a list of only unique keys
|
||||
roles_to_ban |= key
|
||||
@@ -1080,3 +1086,5 @@
|
||||
is_admin = TRUE
|
||||
if(kick_banned_players && (!is_admin || (is_admin && applies_to_admins)))
|
||||
qdel(other_player_client)
|
||||
|
||||
#undef MAX_REASON_LENGTH
|
||||
|
||||
Reference in New Issue
Block a user