mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-23 20:16:19 +01:00
Sanitizes player input.
Purges \red, \blue, \green, \b, \i, etc. due to abuse.
This commit is contained in:
+12
-12
@@ -42,15 +42,15 @@
|
||||
index = findtext(t, char)
|
||||
return t
|
||||
|
||||
/proc/readd_quotes(var/t)
|
||||
var/list/repl_chars = list(""" = "\"")
|
||||
for(var/char in repl_chars)
|
||||
var/index = findtext(t, char)
|
||||
while(index)
|
||||
t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index+5)
|
||||
index = findtext(t, char)
|
||||
return t
|
||||
|
||||
/proc/readd_quotes(var/t)
|
||||
var/list/repl_chars = list(""" = "\"")
|
||||
for(var/char in repl_chars)
|
||||
var/index = findtext(t, char)
|
||||
while(index)
|
||||
t = copytext(t, 1, index) + repl_chars[char] + copytext(t, index+5)
|
||||
index = findtext(t, char)
|
||||
return t
|
||||
|
||||
//Runs byond's sanitization proc along-side sanitize_simple
|
||||
/proc/sanitize(var/t,var/list/repl_chars = null)
|
||||
return html_encode(sanitize_simple(t,repl_chars))
|
||||
@@ -83,7 +83,7 @@
|
||||
/proc/stripped_input(var/mob/user, var/message = "", var/title = "", var/default = "", var/max_length=MAX_MESSAGE_LEN)
|
||||
var/name = input(user, message, title, default)
|
||||
return strip_html_properly(name, max_length)
|
||||
|
||||
|
||||
// Used to get a trimmed, properly sanitized input, of max_length
|
||||
/proc/trim_strip_input(var/mob/user, var/message = "", var/title = "", var/default = "", var/max_length=MAX_MESSAGE_LEN)
|
||||
return trim(stripped_input(user, message, title, default, max_length))
|
||||
@@ -326,7 +326,7 @@ proc/TextPreview(var/string,var/len=40)
|
||||
else
|
||||
return string
|
||||
else
|
||||
return "[copytext(string, 1, 37)]..."
|
||||
return "[copytext(string, 1, 37)]..."
|
||||
|
||||
//This proc strips html properly, but it's not lazy like the other procs.
|
||||
//This means that it doesn't just remove < and > and call it a day.
|
||||
@@ -342,7 +342,7 @@ proc/TextPreview(var/string,var/len=40)
|
||||
input = copytext(input, 1, opentag) + copytext(input, (closetag + 1))
|
||||
if(max_length)
|
||||
input = copytext(input,1,max_length)
|
||||
return input
|
||||
return sanitize(input)
|
||||
|
||||
/proc/trim_strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN)
|
||||
return trim(strip_html_properly(input, max_length))
|
||||
|
||||
Reference in New Issue
Block a user