diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm
index 75113338f3..b7caf86669 100644
--- a/code/__HELPERS/lists.dm
+++ b/code/__HELPERS/lists.dm
@@ -592,13 +592,13 @@ datum/proc/dd_SortValue()
return "[src]"
/obj/machinery/dd_SortValue()
- return "[sanitize(name)]"
+ return "[sanitize_old(name)]"
/obj/machinery/camera/dd_SortValue()
return "[c_tag]"
/datum/alarm/dd_SortValue()
- return "[sanitize(last_name)]"
+ return "[sanitize_old(last_name)]"
//creates every subtype of prototype (excluding prototype) and adds it to list L.
//if no list/L is provided, one is created.
diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm
index 346ffc7c47..54ce601ac7 100644
--- a/code/__HELPERS/text.dm
+++ b/code/__HELPERS/text.dm
@@ -22,46 +22,103 @@
* Text sanitization
*/
-//Simply removes < and > and limits the length of the message
-/proc/strip_html_simple(var/t,var/limit=MAX_MESSAGE_LEN)
- var/list/strip_chars = list("<",">")
- t = copytext(t,1,limit)
- for(var/char in strip_chars)
- var/index = findtext(t, char)
- while(index)
- t = copytext(t, 1, index) + copytext(t, index+1)
- index = findtext(t, char)
- return t
+//Used for preprocessing entered text
+/proc/sanitize(var/input, var/max_length = MAX_MESSAGE_LEN, var/encode = 1, var/trim = 1, var/extra = 1)
+ if(!input)
+ return
-//Removes a few problematic characters
-/proc/sanitize_simple(var/t,var/list/repl_chars = list("\n"="#","\t"="#"))
- for(var/char in repl_chars)
- t = replacetext(t, char, repl_chars[char])
- return t
+ if(max_length)
+ input = copytext(input,1,max_length)
-/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
+ if(extra)
+ input = replace_characters(input, list("\n"=" ","\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))
+ if(encode)
+ //In addition to processing html, html_encode removes byond formatting codes like "\red", "\i" and other.
+ //It is important to avoid double-encode text, it can "break" quotes and some other characters.
+ //Also, keep in mind that escaped characters don't work in the interface (window titles, lower left corner of the main window, etc.)
+ input = html_encode(input)
+ else
+ //If not need encode text, simply remove < and >
+ //note: we can also remove here byond formatting codes: 0xFF + next byte
+ input = replace_characters(input, list("<"=" ", ">"=" "))
-//Runs sanitize and strip_html_simple
-//I believe strip_html_simple() is required to run first to prevent '<' from displaying as '<' after sanitize() calls byond's html_encode()
-/proc/strip_html(var/t,var/limit=MAX_MESSAGE_LEN)
- return copytext((sanitize(strip_html_simple(t))),1,limit)
+ if(trim)
+ //Maybe, we need trim text twice? Here and before copytext?
+ input = trim(input)
-//Runs byond's sanitization proc along-side strip_html_simple
-//I believe strip_html_simple() is required to run first to prevent '<' from displaying as '<' that html_encode() would cause
-/proc/adminscrub(var/t,var/limit=MAX_MESSAGE_LEN)
- return copytext((html_encode(strip_html_simple(t))),1,limit)
+ return input
+//Run sanitize(), but remove <, >, " first to prevent displaying them as > < &34; in some places, after html_encode().
+//Best used for sanitize object names, window titles.
+//If you have a problem with sanitize() in chat, when quotes and >, < are displayed as html entites -
+//this is a problem of double-encode(when & becomes &), use sanitize() with encode=0, but not the sanitizeSafe()!
+/proc/sanitizeSafe(var/input, var/max_length = MAX_MESSAGE_LEN, var/encode = 1, var/trim = 1, var/extra = 1)
+ return sanitize(replace_characters(input, list(">"=" ","<"=" ", "\""="'"), max_length, encode, trim, extra))
+
+//Filters out undesirable characters from names
+/proc/sanitizeName(var/input, var/max_length = MAX_NAME_LEN, var/allow_numbers = 0)
+ if(!input || length(input) > max_length)
+ return //Rejects the input if it is null or if it is longer then the max length allowed
+
+ var/number_of_alphanumeric = 0
+ var/last_char_group = 0
+ var/output = ""
+
+ for(var/i=1, i<=length(input), i++)
+ var/ascii_char = text2ascii(input,i)
+ switch(ascii_char)
+ // A .. Z
+ if(65 to 90) //Uppercase Letters
+ output += ascii2text(ascii_char)
+ number_of_alphanumeric++
+ last_char_group = 4
+
+ // a .. z
+ if(97 to 122) //Lowercase Letters
+ if(last_char_group<2) output += ascii2text(ascii_char-32) //Force uppercase first character
+ else output += ascii2text(ascii_char)
+ number_of_alphanumeric++
+ last_char_group = 4
+
+ // 0 .. 9
+ if(48 to 57) //Numbers
+ if(!last_char_group) continue //suppress at start of string
+ if(!allow_numbers) continue
+ output += ascii2text(ascii_char)
+ number_of_alphanumeric++
+ last_char_group = 3
+
+ // ' - .
+ if(39,45,46) //Common name punctuation
+ if(!last_char_group) continue
+ output += ascii2text(ascii_char)
+ last_char_group = 2
+
+ // ~ | @ : # $ % & * +
+ if(126,124,64,58,35,36,37,38,42,43) //Other symbols that we'll allow (mainly for AI)
+ if(!last_char_group) continue //suppress at start of string
+ if(!allow_numbers) continue
+ output += ascii2text(ascii_char)
+ last_char_group = 2
+
+ //Space
+ if(32)
+ if(last_char_group <= 1) continue //suppress double-spaces and spaces at start of string
+ output += ascii2text(ascii_char)
+ last_char_group = 1
+ else
+ return
+
+ if(number_of_alphanumeric < 2) return //protects against tiny names like "A" and also names like "' ' ' ' ' ' ' '"
+
+ if(last_char_group == 1)
+ output = copytext(output,1,length(output)) //removes the last character (in this case a space)
+
+ for(var/bad_name in list("space","floor","wall","r-wall","monkey","unknown","inactive ai")) //prevents these common metagamey names
+ if(cmptext(output,bad_name)) return //(not case sensitive)
+
+ return output
//Returns null if there is any bad text in the string
/proc/reject_bad_text(var/text, var/max_length=512)
@@ -76,97 +133,11 @@
else non_whitespace = 1
if(non_whitespace) return text //only accepts the text if it has some non-spaces
-// Used to get a properly sanitized input, of max_length
-/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))
+//Old variant. Haven't dared to replace in some places.
+/proc/sanitize_old(var/t,var/list/repl_chars = list("\n"="#","\t"="#"))
+ return html_encode(replace_characters(t,repl_chars))
-//Filters out undesirable characters from names
-/proc/reject_bad_name(var/t_in, var/allow_numbers=0, var/max_length=MAX_NAME_LEN)
- if(!t_in || length(t_in) > max_length)
- return //Rejects the input if it is null or if it is longer then the max length allowed
-
- var/number_of_alphanumeric = 0
- var/last_char_group = 0
- var/t_out = ""
-
- for(var/i=1, i<=length(t_in), i++)
- var/ascii_char = text2ascii(t_in,i)
- switch(ascii_char)
- // A .. Z
- if(65 to 90) //Uppercase Letters
- t_out += ascii2text(ascii_char)
- number_of_alphanumeric++
- last_char_group = 4
-
- // a .. z
- if(97 to 122) //Lowercase Letters
- if(last_char_group<2) t_out += ascii2text(ascii_char-32) //Force uppercase first character
- else t_out += ascii2text(ascii_char)
- number_of_alphanumeric++
- last_char_group = 4
-
- // 0 .. 9
- if(48 to 57) //Numbers
- if(!last_char_group) continue //suppress at start of string
- if(!allow_numbers) continue
- t_out += ascii2text(ascii_char)
- number_of_alphanumeric++
- last_char_group = 3
-
- // ' - .
- if(39,45,46) //Common name punctuation
- if(!last_char_group) continue
- t_out += ascii2text(ascii_char)
- last_char_group = 2
-
- // ~ | @ : # $ % & * +
- if(126,124,64,58,35,36,37,38,42,43) //Other symbols that we'll allow (mainly for AI)
- if(!last_char_group) continue //suppress at start of string
- if(!allow_numbers) continue
- t_out += ascii2text(ascii_char)
- last_char_group = 2
-
- //Space
- if(32)
- if(last_char_group <= 1) continue //suppress double-spaces and spaces at start of string
- t_out += ascii2text(ascii_char)
- last_char_group = 1
- else
- return
-
- if(number_of_alphanumeric < 2) return //protects against tiny names like "A" and also names like "' ' ' ' ' ' ' '"
-
- if(last_char_group == 1)
- t_out = copytext(t_out,1,length(t_out)) //removes the last character (in this case a space)
-
- for(var/bad_name in list("space","floor","wall","r-wall","monkey","unknown","inactive ai")) //prevents these common metagamey names
- if(cmptext(t_out,bad_name)) return //(not case sensitive)
-
- return t_out
-
-//checks text for html tags
-//if tag is not in whitelist (var/list/paper_tag_whitelist in global.dm)
-//relpaces < with <
-proc/checkhtml(var/t)
- t = sanitize_simple(t, list(""="."))
- var/p = findtext(t,"<",1)
- while (p) //going through all the tags
- var/start = p++
- var/tag = copytext(t,p, p+1)
- if (tag != "/")
- while (reject_bad_text(copytext(t, p, p+1), 1))
- tag = copytext(t,start, p)
- p++
- tag = copytext(t,start+1, p)
- if (!(tag in paper_tag_whitelist)) //if it's unkown tag, disarming it
- t = copytext(t,1,start-1) + "<" + copytext(t,start+1)
- p = findtext(t,"<",p)
- return t
/*
* Text searches
*/
@@ -203,12 +174,18 @@ proc/checkhtml(var/t)
/*
* Text modification
*/
+
/proc/replacetext(text, find, replacement)
return list2text(text2list(text, find), replacement)
/proc/replacetextEx(text, find, replacement)
return list2text(text2listEx(text, find), replacement)
+/proc/replace_characters(var/t,var/list/repl_chars)
+ for(var/char in repl_chars)
+ replacetext(t, char, repl_chars[char])
+ return t
+
//Adds 'u' number of zeros ahead of the text 't'
/proc/add_zero(t, u)
while (length(t) < u)
@@ -239,7 +216,6 @@ proc/checkhtml(var/t)
for (var/i = length(text), i > 0, i--)
if (text2ascii(text, i) > 32)
return copytext(text, 1, i + 1)
-
return ""
//Returns a string with reserved characters and spaces before the first word and after the last word removed.
@@ -250,43 +226,18 @@ proc/checkhtml(var/t)
/proc/capitalize(var/t as text)
return uppertext(copytext(t, 1, 2)) + copytext(t, 2)
-//Centers text by adding spaces to either side of the string.
-/proc/dd_centertext(message, length)
- var/new_message = message
- var/size = length(message)
- var/delta = length - size
- if(size == length)
- return new_message
- if(size > length)
- return copytext(new_message, 1, length + 1)
- if(delta == 1)
- return new_message + " "
- if(delta % 2)
- new_message = " " + new_message
- delta--
- var/spaces = add_lspace("",delta/2-1)
- return spaces + new_message + spaces
-
-//Limits the length of the text. Note: MAX_MESSAGE_LEN and MAX_NAME_LEN are widely used for this purpose
-/proc/dd_limittext(message, length)
- var/size = length(message)
- if(size <= length)
- return message
- return copytext(message, 1, length + 1)
-
-
-/proc/stringmerge(var/text,var/compare,replace = "*")
//This proc fills in all spaces with the "replace" var (* by default) with whatever
//is in the other string at the same spot (assuming it is not a replace char).
//This is used for fingerprints
+/proc/stringmerge(var/text,var/compare,replace = "*")
var/newtext = text
if(lentext(text) != lentext(compare))
return 0
for(var/i = 1, i < lentext(text), i++)
var/a = copytext(text,i,i+1)
var/b = copytext(compare,i,i+1)
-//if it isn't both the same letter, or if they are both the replacement character
-//(no way to know what it was supposed to be)
+ //if it isn't both the same letter, or if they are both the replacement character
+ //(no way to know what it was supposed to be)
if(a != b)
if(a == replace) //if A is the replacement char
newtext = copytext(newtext,1,i) + b + copytext(newtext, i+1)
@@ -296,9 +247,9 @@ proc/checkhtml(var/t)
return 0
return newtext
-/proc/stringpercent(var/text,character = "*")
//This proc returns the number of chars of the string that is the character
//This is used for detective work to determine fingerprint completion.
+/proc/stringpercent(var/text,character = "*")
if(!text || !character)
return 0
var/count = 0
@@ -325,36 +276,6 @@ proc/TextPreview(var/string,var/len=40)
else
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.
-//Also limit the size of the input, if specified.
-/proc/strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN)
- if(!input)
- return
- var/opentag = 1 //These store the position of < and > respectively.
- var/closetag = 1
- while(1)
- opentag = findtext(input, "<")
- closetag = findtext(input, ">")
- if(closetag && opentag)
- if(closetag < opentag)
- input = copytext(input, (closetag + 1))
- else
- input = copytext(input, 1, opentag) + copytext(input, (closetag + 1))
- else if(closetag || opentag)
- if(opentag)
- input = copytext(input, 1, opentag)
- else
- input = copytext(input, (closetag + 1))
- else
- break
- if(max_length)
- input = copytext(input,1,max_length)
- return sanitize(input)
-
-/proc/trim_strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN)
- return trim(strip_html_properly(input, max_length))
-
//For generating neat chat tag-images
//The icon var could be local in the proc, but it's a waste of resources
// to always create it and then throw it out.
diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index 017da23bfa..72d85a67b5 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -311,7 +311,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
newname = input(src,"You are \a [role]. Would you like to change your name to something else?", "Name change",oldname) as text
if((world.time-time_passed)>3000)
return //took too long
- newname = reject_bad_name(newname,allow_numbers) //returns null if the name doesn't meet some basic requirements. Tidies up a few other things like bad-characters.
+ newname = sanitizeName(newname, ,allow_numbers) //returns null if the name doesn't meet some basic requirements. Tidies up a few other things like bad-characters.
for(var/mob/living/M in player_list)
if(M == src)
diff --git a/code/controllers/voting.dm b/code/controllers/voting.dm
index 34658944bc..7db31c6fa6 100644
--- a/code/controllers/voting.dm
+++ b/code/controllers/voting.dm
@@ -241,10 +241,10 @@ datum/controller/vote
choices.Add(antag.role_text)
choices.Add("None")
if("custom")
- question = html_encode(input(usr,"What is the vote for?") as text|null)
+ question = sanitizeSafe(input(usr,"What is the vote for?") as text|null)
if(!question) return 0
for(var/i=1,i<=10,i++)
- var/option = capitalize(html_encode(input(usr,"Please enter an option or hit cancel to finish") as text|null))
+ var/option = capitalize(sanitize(input(usr,"Please enter an option or hit cancel to finish") as text|null))
if(!option || mode || !usr.client) break
choices.Add(option)
else
diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm
index ad432cc22c..8daad7bfc1 100644
--- a/code/datums/datumvars.dm
+++ b/code/datums/datumvars.dm
@@ -427,7 +427,7 @@ client
usr << "This can only be used on instances of type /mob"
return
- var/new_name = sanitize(copytext(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null,1,MAX_NAME_LEN))
+ var/new_name = sanitize(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null, MAX_NAME_LEN)
if( !new_name || !M ) return
message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].")
@@ -875,7 +875,7 @@ client
return
if(organ_slot != "default")
- organ_slot = sanitize(copytext(organ_slot,1,MAX_MESSAGE_LEN))
+ organ_slot = sanitize(organ_slot)
else
if(I.removed_type)
var/obj/item/organ/O = new I.removed_type()
diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm
index bea5672006..70acceca35 100644
--- a/code/datums/diseases/advance/advance.dm
+++ b/code/datums/diseases/advance/advance.dm
@@ -394,7 +394,7 @@ var/list/advance_cures = list(
if(D.symptoms.len > 0)
- var/new_name = input(user, "Name your new disease.", "New Name")
+ var/new_name = sanitizeSafe(input(user, "Name your new disease.", "New Name"), MAX_NAME_LEN)
D.AssignName(new_name)
D.Refresh()
diff --git a/code/datums/mind.dm b/code/datums/mind.dm
index be44f56056..1d6d703c16 100644
--- a/code/datums/mind.dm
+++ b/code/datums/mind.dm
@@ -166,7 +166,7 @@ datum/mind
assigned_role = new_role
else if (href_list["memory_edit"])
- var/new_memo = sanitize(copytext(input("Write new memory", "Memory", memory) as null|message,1,MAX_MESSAGE_LEN))
+ var/new_memo = sanitize(input("Write new memory", "Memory", memory) as null|message)
if (isnull(new_memo)) return
memory = new_memo
@@ -277,7 +277,7 @@ datum/mind
new_objective.target_amount = target_number
if ("custom")
- var/expl = sanitize(copytext(input("Custom objective:", "Objective", objective ? objective.explanation_text : "") as text|null,1,MAX_MESSAGE_LEN))
+ var/expl = sanitize(input("Custom objective:", "Objective", objective ? objective.explanation_text : "") as text|null)
if (!expl) return
new_objective = new /datum/objective
new_objective.owner = src
diff --git a/code/defines/procs/announce.dm b/code/defines/procs/announce.dm
index d3aef96c45..3e5454d8ac 100644
--- a/code/defines/procs/announce.dm
+++ b/code/defines/procs/announce.dm
@@ -36,8 +36,8 @@
var/tmp/message_title = new_title ? new_title : title
var/tmp/message_sound = new_sound ? sound(new_sound) : sound
- message = trim_strip_html_properly(message)
- message_title = html_encode(message_title)
+ message = sanitize(message, extra = 0)
+ message_title = sanitizeSafe(message_title)
Message(message, message_title)
if(do_newscast)
diff --git a/code/game/antagonist/antagonist_build.dm b/code/game/antagonist/antagonist_build.dm
index 6bf8f1e864..f0f92c62b7 100644
--- a/code/game/antagonist/antagonist_build.dm
+++ b/code/game/antagonist/antagonist_build.dm
@@ -52,7 +52,7 @@
// Choose a name, if any.
if(flags & ANTAG_CHOOSE_NAME)
spawn(5)
- var/newname = sanitize(copytext(input(player.current, "You are a [role_text]. Would you like to change your name to something else?", "Name change") as null|text,1,MAX_NAME_LEN))
+ var/newname = sanitize(input(player.current, "You are a [role_text]. Would you like to change your name to something else?", "Name change") as null|text, MAX_NAME_LEN)
if (newname)
player.current.real_name = newname
player.current.name = player.current.real_name
diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm
index 65f797658d..86bfbeb0fe 100644
--- a/code/game/dna/dna_modifier.dm
+++ b/code/game/dna/dna_modifier.dm
@@ -737,7 +737,7 @@
if (bufferOption == "changeLabel")
var/datum/dna2/record/buf = src.buffers[bufferId]
- var/text = sanitize(copytext(input(usr, "New Label:", "Edit Label", buf.name) as text|null, 1, MAX_NAME_LEN))
+ var/text = sanitize(input(usr, "New Label:", "Edit Label", buf.name) as text|null, MAX_NAME_LEN)
buf.name = text
src.buffers[bufferId] = buf
return 1
diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm
index bad1e095e8..530a009b67 100644
--- a/code/game/gamemodes/changeling/changeling_powers.dm
+++ b/code/game/gamemodes/changeling/changeling_powers.dm
@@ -657,7 +657,7 @@ var/list/datum/dna/hivemind_bank = list()
src << "We return our vocal glands to their original location."
return
- var/mimic_voice = stripped_input(usr, "Enter a name to mimic.", "Mimic Voice", null, MAX_NAME_LEN)
+ var/mimic_voice = sanitize(input(usr, "Enter a name to mimic.", "Mimic Voice", null), MAX_NAME_LEN)
if(!mimic_voice)
return
diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm
index 8008549d36..30ce1206e5 100644
--- a/code/game/gamemodes/cult/runes.dm
+++ b/code/game/gamemodes/cult/runes.dm
@@ -564,7 +564,7 @@ var/list/sacrificed = list()
// returns 0 if the rune is not used. returns 1 if the rune is used.
communicate()
. = 1 // Default output is 1. If the rune is deleted it will return 1
- var/input = stripped_input(usr, "Please choose a message to tell to the other acolytes.", "Voice of Blood", "")
+ var/input = sanitize(input(usr, "Please choose a message to tell to the other acolytes.", "Voice of Blood", ""))
if(!input)
if (istype(src))
fizzle()
diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm
index 995648e4fe..ba53c38525 100644
--- a/code/game/gamemodes/objective.dm
+++ b/code/game/gamemodes/objective.dm
@@ -536,7 +536,7 @@ datum/objective/steal
var/tmp_obj = new custom_target
var/custom_name = tmp_obj:name
del(tmp_obj)
- custom_name = sanitize(copytext(input("Enter target name:", "Objective target", custom_name) as text|null,1,MAX_MESSAGE_LEN))
+ custom_name = sanitize(input("Enter target name:", "Objective target", custom_name) as text|null)
if (!custom_name) return
target_name = custom_name
steal_target = custom_target
diff --git a/code/game/jobs/job/civilian_chaplain.dm b/code/game/jobs/job/civilian_chaplain.dm
index 4131ec9b55..9b08e0d47c 100644
--- a/code/game/jobs/job/civilian_chaplain.dm
+++ b/code/game/jobs/job/civilian_chaplain.dm
@@ -28,7 +28,7 @@
H.equip_to_slot_or_del(new /obj/item/weapon/storage/box/survival(H.back), slot_in_backpack)
spawn(0)
var/religion_name = "Christianity"
- var/new_religion = sanitize(copytext(input(H, "You are the crew services officer. Would you like to change your religion? Default is Christianity, in SPACE.", "Name change", religion_name),1,MAX_NAME_LEN))
+ var/new_religion = sanitize(input(H, "You are the crew services officer. Would you like to change your religion? Default is Christianity, in SPACE.", "Name change", religion_name), MAX_NAME_LEN)
if (!new_religion)
new_religion = religion_name
@@ -63,7 +63,7 @@
spawn(1)
var/deity_name = "Space Jesus"
- var/new_deity = sanitize(copytext(input(H, "Would you like to change your deity? Default is Space Jesus.", "Name change", deity_name),1,MAX_NAME_LEN))
+ var/new_deity = sanitize(input(H, "Would you like to change your deity? Default is Space Jesus.", "Name change", deity_name), MAX_NAME_LEN)
if ((length(new_deity) == 0) || (new_deity == "Space Jesus") )
new_deity = deity_name
diff --git a/code/game/machinery/bots/cleanbot.dm b/code/game/machinery/bots/cleanbot.dm
index f4d9dd0c59..4dcb838152 100644
--- a/code/game/machinery/bots/cleanbot.dm
+++ b/code/game/machinery/bots/cleanbot.dm
@@ -355,7 +355,7 @@ text("[src.oddbutton ? "Yes" : "No"
del(src)
else if (istype(W, /obj/item/weapon/pen))
- var/t = copytext(stripped_input(user, "Enter new robot name", src.name, src.created_name),1,MAX_NAME_LEN)
+ var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if (!t)
return
if (!in_range(src, usr) && src.loc != usr)
diff --git a/code/game/machinery/bots/ed209bot.dm b/code/game/machinery/bots/ed209bot.dm
index 639da55bf5..f225b9ce8d 100644
--- a/code/game/machinery/bots/ed209bot.dm
+++ b/code/game/machinery/bots/ed209bot.dm
@@ -58,7 +58,7 @@
..()
if(istype(W, /obj/item/weapon/pen))
- var/t = copytext(stripped_input(user, "Enter new robot name", src.name, src.created_name),1,MAX_NAME_LEN)
+ var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if(!t) return
if(!in_range(src, usr) && src.loc != usr) return
created_name = t
diff --git a/code/game/machinery/bots/farmbot.dm b/code/game/machinery/bots/farmbot.dm
index 4db416e7a6..f91607eeb5 100644
--- a/code/game/machinery/bots/farmbot.dm
+++ b/code/game/machinery/bots/farmbot.dm
@@ -583,7 +583,7 @@
else if(istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text
- t = sanitize(copytext(t, 1, MAX_NAME_LEN))
+ t = sanitize(t, MAX_NAME_LEN)
if (!t)
return
if (!in_range(src, usr) && src.loc != usr)
diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm
index 54c8390234..b3c1c0376f 100644
--- a/code/game/machinery/bots/floorbot.dm
+++ b/code/game/machinery/bots/floorbot.dm
@@ -420,7 +420,7 @@
del(src)
else if (istype(W, /obj/item/weapon/pen))
- var/t = copytext(stripped_input(user, "Enter new robot name", src.name, src.created_name),1,MAX_NAME_LEN)
+ var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if (!t)
return
if (!in_range(src, usr) && src.loc != usr)
@@ -439,7 +439,7 @@
user.drop_from_inventory(src)
del(src)
else if (istype(W, /obj/item/weapon/pen))
- var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name)
+ var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if (!t)
return
diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm
index fbcb7d448e..8ce3522707 100644
--- a/code/game/machinery/bots/medbot.dm
+++ b/code/game/machinery/bots/medbot.dm
@@ -564,7 +564,7 @@
/obj/item/weapon/firstaid_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
if(istype(W, /obj/item/weapon/pen))
- var/t = copytext(stripped_input(user, "Enter new robot name", src.name, src.created_name),1,MAX_NAME_LEN)
+ var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if (!t)
return
if (!in_range(src, usr) && src.loc != usr)
diff --git a/code/game/machinery/bots/mulebot.dm b/code/game/machinery/bots/mulebot.dm
index 56f33676d5..bd39d2034c 100644
--- a/code/game/machinery/bots/mulebot.dm
+++ b/code/game/machinery/bots/mulebot.dm
@@ -307,7 +307,7 @@
if("setid")
refresh=0
- var/new_id = sanitize(copytext(input("Enter new bot ID", "Mulebot [suffix ? "([suffix])" : ""]", suffix) as text|null,1,MAX_NAME_LEN))
+ var/new_id = sanitize(input("Enter new bot ID", "Mulebot [suffix ? "([suffix])" : ""]", suffix) as text|null, MAX_NAME_LEN)
refresh=1
if(new_id)
suffix = new_id
diff --git a/code/game/machinery/bots/secbot.dm b/code/game/machinery/bots/secbot.dm
index f1283e5efc..92b7297c42 100644
--- a/code/game/machinery/bots/secbot.dm
+++ b/code/game/machinery/bots/secbot.dm
@@ -838,7 +838,7 @@ Auto Patrol: []"},
del(src)
else if(istype(W, /obj/item/weapon/pen))
- var/t = copytext(stripped_input(user, "Enter new robot name", src.name, src.created_name),1,MAX_NAME_LEN)
+ var/t = sanitizeSafe(input(user, "Enter new robot name", src.name, src.created_name), MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && src.loc != usr)
diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm
index 4ece6594f0..a038ece414 100644
--- a/code/game/machinery/camera/camera_assembly.dm
+++ b/code/game/machinery/camera/camera_assembly.dm
@@ -78,7 +78,7 @@
if(isscrewdriver(W))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
- var/input = strip_html(input(usr, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13"))
+ var/input = sanitize(input(usr, "Which networks would you like to connect this camera to? Separate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Set Network", "SS13"))
if(!input)
usr << "No input found please hang up and try your call again."
return
@@ -90,7 +90,7 @@
var/area/camera_area = get_area(src)
var/temptag = "[sanitize(camera_area.name)] ([rand(1, 999)])"
- input = strip_html(input(usr, "How would you like to name the camera?", "Set Camera Name", temptag))
+ input = sanitizeSafe(input(usr, "How would you like to name the camera?", "Set Camera Name", temptag))
state = 4
var/obj/machinery/camera/C = new(src.loc)
diff --git a/code/game/machinery/camera/tracking.dm b/code/game/machinery/camera/tracking.dm
index c2a64dbad3..b781613d70 100644
--- a/code/game/machinery/camera/tracking.dm
+++ b/code/game/machinery/camera/tracking.dm
@@ -47,7 +47,7 @@
set name = "Store Camera Location"
set desc = "Stores your current camera location by the given name"
- loc = sanitize(copytext(loc, 1, MAX_MESSAGE_LEN))
+ loc = sanitize(loc)
if(!loc)
src << "\red Must supply a location name"
return
diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm
index be5a73d90f..4e97506088 100644
--- a/code/game/machinery/computer/card.dm
+++ b/code/game/machinery/computer/card.dm
@@ -191,7 +191,7 @@
if (is_authenticated() && modify)
var/t1 = href_list["assign_target"]
if(t1 == "Custom")
- var/temp_t = sanitize(copytext(input("Enter a custom job assignment.","Assignment"),1,45))
+ var/temp_t = sanitize(input("Enter a custom job assignment.","Assignment"), 45)
//let custom jobs function as an impromptu alt title, mainly for sechuds
if(temp_t && modify)
modify.assignment = temp_t
@@ -222,7 +222,7 @@
if (is_authenticated())
var/t2 = modify
if ((modify == t2 && (in_range(src, usr) || (istype(usr, /mob/living/silicon))) && istype(loc, /turf)))
- var/temp_name = reject_bad_name(href_list["reg"])
+ var/temp_name = sanitizeName(href_list["reg"])
if(temp_name)
modify.registered_name = temp_name
else
diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm
index bc9f982477..4015b907f9 100644
--- a/code/game/machinery/computer/communications.dm
+++ b/code/game/machinery/computer/communications.dm
@@ -175,10 +175,10 @@
post_status(href_list["statdisp"])
if("setmsg1")
- stat_msg1 = reject_bad_text(trim(sanitize(copytext(input("Line 1", "Enter Message Text", stat_msg1) as text|null, 1, 40))), 40)
+ stat_msg1 = reject_bad_text(sanitize(input("Line 1", "Enter Message Text", stat_msg1) as text|null, 40), 40)
src.updateDialog()
if("setmsg2")
- stat_msg2 = reject_bad_text(trim(sanitize(copytext(input("Line 2", "Enter Message Text", stat_msg2) as text|null, 1, 40))), 40)
+ stat_msg2 = reject_bad_text(sanitize(input("Line 2", "Enter Message Text", stat_msg2) as text|null, 40), 40)
src.updateDialog()
// OMG CENTCOMM LETTERHEAD
@@ -187,7 +187,7 @@
if(centcomm_message_cooldown)
usr << "\red Arrays recycling. Please stand by."
return
- var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", "")
+ var/input = sanitize(input("Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", ""))
if(!input || !(usr in view(1,src)))
return
Centcomm_announce(input, usr)
@@ -204,7 +204,7 @@
if(centcomm_message_cooldown)
usr << "\red Arrays recycling. Please stand by."
return
- var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", "")
+ var/input = sanitize(input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", ""))
if(!input || !(usr in view(1,src)))
return
Syndicate_announce(input, usr)
diff --git a/code/game/machinery/computer/guestpass.dm b/code/game/machinery/computer/guestpass.dm
index 121942a418..40fc0b9914 100644
--- a/code/game/machinery/computer/guestpass.dm
+++ b/code/game/machinery/computer/guestpass.dm
@@ -114,11 +114,11 @@
if (href_list["choice"])
switch(href_list["choice"])
if ("giv_name")
- var/nam = strip_html_simple(input("Person pass is issued to", "Name", giv_name) as text|null)
+ var/nam = sanitize(input("Person pass is issued to", "Name", giv_name) as text|null)
if (nam)
giv_name = nam
if ("reason")
- var/reas = strip_html_simple(input("Reason why pass is issued", "Reason", reason) as text|null)
+ var/reas = sanitize(input("Reason why pass is issued", "Reason", reason) as text|null)
if(reas)
reason = reas
if ("duration")
diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm
index 562b92a2df..c6a30995d2 100644
--- a/code/game/machinery/computer/medical.dm
+++ b/code/game/machinery/computer/medical.dm
@@ -250,7 +250,7 @@
switch(href_list["field"])
if("fingerprint")
if (istype(src.active1, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input fingerprint hash:", "Med. records", src.active1.fields["fingerprint"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input fingerprint hash:", "Med. records", src.active1.fields["fingerprint"], null) as text)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active1 != a1))
return
src.active1.fields["fingerprint"] = t1
@@ -268,55 +268,55 @@
src.active1.fields["age"] = t1
if("mi_dis")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input minor disabilities list:", "Med. records", src.active2.fields["mi_dis"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input minor disabilities list:", "Med. records", src.active2.fields["mi_dis"], null) as text)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["mi_dis"] = t1
if("mi_dis_d")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please summarize minor dis.:", "Med. records", src.active2.fields["mi_dis_d"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize minor dis.:", "Med. records", src.active2.fields["mi_dis_d"], null) as message)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["mi_dis_d"] = t1
if("ma_dis")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input major diabilities list:", "Med. records", src.active2.fields["ma_dis"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input major diabilities list:", "Med. records", src.active2.fields["ma_dis"], null) as text)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["ma_dis"] = t1
if("ma_dis_d")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please summarize major dis.:", "Med. records", src.active2.fields["ma_dis_d"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize major dis.:", "Med. records", src.active2.fields["ma_dis_d"], null) as message)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["ma_dis_d"] = t1
if("alg")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please state allergies:", "Med. records", src.active2.fields["alg"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please state allergies:", "Med. records", src.active2.fields["alg"], null) as text)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["alg"] = t1
if("alg_d")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please summarize allergies:", "Med. records", src.active2.fields["alg_d"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize allergies:", "Med. records", src.active2.fields["alg_d"], null) as message)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["alg_d"] = t1
if("cdi")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please state diseases:", "Med. records", src.active2.fields["cdi"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please state diseases:", "Med. records", src.active2.fields["cdi"], null) as text)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["cdi"] = t1
if("cdi_d")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please summarize diseases:", "Med. records", src.active2.fields["cdi_d"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize diseases:", "Med. records", src.active2.fields["cdi_d"], null) as message)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["cdi_d"] = t1
if("notes")
if (istype(src.active2, /datum/data/record))
- var/t1 = html_encode(trim(copytext(input("Please summarize notes:", "Med. records", html_decode(src.active2.fields["notes"]), null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize notes:", "Med. records", html_decode(src.active2.fields["notes"]), null) as message, extra = 0)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["notes"] = t1
@@ -331,21 +331,21 @@
src.temp = text("Blood Type:
\n\tA- A+
\n\tB- B+
\n\tAB- AB+
\n\tO- O+
", src, src, src, src, src, src, src, src)
if("b_dna")
if (istype(src.active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input DNA hash:", "Med. records", src.active2.fields["b_dna"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input DNA hash:", "Med. records", src.active2.fields["b_dna"], null) as text)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
src.active2.fields["b_dna"] = t1
if("vir_name")
var/datum/data/record/v = locate(href_list["edit_vir"])
if (v)
- var/t1 = trim(sanitize(copytext(input("Please input pathogen name:", "VirusDB", v.fields["name"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input pathogen name:", "VirusDB", v.fields["name"], null) as text)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active1 != a1))
return
v.fields["name"] = t1
if("vir_desc")
var/datum/data/record/v = locate(href_list["edit_vir"])
if (v)
- var/t1 = trim(sanitize(copytext(input("Please input information about pathogen:", "VirusDB", v.fields["description"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input information about pathogen:", "VirusDB", v.fields["description"], null) as message)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active1 != a1))
return
v.fields["description"] = t1
@@ -450,7 +450,7 @@
if (!( istype(src.active2, /datum/data/record) ))
return
var/a2 = src.active2
- var/t1 = trim(sanitize(copytext(input("Add Comment:", "Med. records", null, null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Add Comment:", "Med. records", null, null) as message)
if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2))
return
var/counter = 1
diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm
index bc7892b9bc..94eadf7f11 100644
--- a/code/game/machinery/computer/message.dm
+++ b/code/game/machinery/computer/message.dm
@@ -409,7 +409,7 @@
//Select Your Name
if("Sender")
- customsender = input(usr, "Please enter the sender's name.") as text|null
+ customsender = sanitize(input(usr, "Please enter the sender's name.") as text|null)
//Select Receiver
if("Recepient")
@@ -425,12 +425,12 @@
//Enter custom job
if("RecJob")
- customjob = input(usr, "Please enter the sender's job.") as text|null
+ customjob = sanitize(input(usr, "Please enter the sender's job.") as text|null)
//Enter message
if("Message")
custommessage = input(usr, "Please enter your message.") as text|null
- custommessage = sanitize(copytext(custommessage, 1, MAX_MESSAGE_LEN))
+ custommessage = sanitize(custommessage)
//Send message
if("Send")
diff --git a/code/game/machinery/computer/prisoner.dm b/code/game/machinery/computer/prisoner.dm
index 00e7554727..976209305a 100644
--- a/code/game/machinery/computer/prisoner.dm
+++ b/code/game/machinery/computer/prisoner.dm
@@ -90,7 +90,7 @@
usr << "Unauthorized Access."
else if(href_list["warn"])
- var/warning = sanitize(copytext(input(usr,"Message:","Enter your message here!",""),1,MAX_MESSAGE_LEN))
+ var/warning = sanitize(input(usr,"Message:","Enter your message here!",""))
if(!warning) return
var/obj/item/weapon/implant/I = locate(href_list["warn"])
if((I)&&(I.imp_in))
diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm
index 5d5d995a41..c05f0f78be 100644
--- a/code/game/machinery/computer/security.dm
+++ b/code/game/machinery/computer/security.dm
@@ -384,7 +384,7 @@ What a mess.*/
if (!( istype(active2, /datum/data/record) ))
return
var/a2 = active2
- var/t1 = trim(sanitize(copytext(input("Add Comment:", "Secure. records", null, null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Add Comment:", "Secure. records", null, null) as message)
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active2 != a2))
return
var/counter = 1
@@ -426,19 +426,19 @@ What a mess.*/
switch(href_list["field"])
if("name")
if (istype(active1, /datum/data/record))
- var/t1 = reject_bad_name(input("Please input name:", "Secure. records", active1.fields["name"], null) as text)
+ var/t1 = sanitizeName(input("Please input name:", "Secure. records", active1.fields["name"], null) as text)
if (!t1 || active1 != a1)
return
active1.fields["name"] = t1
if("id")
if (istype(active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input id:", "Secure. records", active1.fields["id"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input id:", "Secure. records", active1.fields["id"], null) as text)
if (!t1 || active1 != a1)
return
active1.fields["id"] = t1
if("fingerprint")
if (istype(active1, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text)
if (!t1 || active1 != a1)
return
active1.fields["fingerprint"] = t1
@@ -456,31 +456,31 @@ What a mess.*/
active1.fields["age"] = t1
if("mi_crim")
if (istype(active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input minor disabilities list:", "Secure. records", active2.fields["mi_crim"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input minor disabilities list:", "Secure. records", active2.fields["mi_crim"], null) as text)
if (!t1 || active2 != a2)
return
active2.fields["mi_crim"] = t1
if("mi_crim_d")
if (istype(active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please summarize minor dis.:", "Secure. records", active2.fields["mi_crim_d"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize minor dis.:", "Secure. records", active2.fields["mi_crim_d"], null) as message)
if (!t1 || active2 != a2)
return
active2.fields["mi_crim_d"] = t1
if("ma_crim")
if (istype(active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input major diabilities list:", "Secure. records", active2.fields["ma_crim"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input major diabilities list:", "Secure. records", active2.fields["ma_crim"], null) as text)
if (!t1 || active2 != a2)
return
active2.fields["ma_crim"] = t1
if("ma_crim_d")
if (istype(active2, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please summarize major dis.:", "Secure. records", active2.fields["ma_crim_d"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize major dis.:", "Secure. records", active2.fields["ma_crim_d"], null) as message)
if (!t1 || active2 != a2)
return
active2.fields["ma_crim_d"] = t1
if("notes")
if (istype(active2, /datum/data/record))
- var/t1 = html_encode(trim(copytext(input("Please summarize notes:", "Secure. records", html_decode(active2.fields["notes"]), null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please summarize notes:", "Secure. records", html_decode(active2.fields["notes"]), null) as message, extra = 0)
if (!t1 || active2 != a2)
return
active2.fields["notes"] = t1
@@ -507,7 +507,7 @@ What a mess.*/
alert(usr, "You do not have the required rank to do this!")
if("species")
if (istype(active1, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please enter race:", "General records", active1.fields["species"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please enter race:", "General records", active1.fields["species"], null) as message)
if (!t1 || active1 != a1)
return
active1.fields["species"] = t1
diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm
index 4d4997d23b..aa92a59094 100644
--- a/code/game/machinery/computer/skills.dm
+++ b/code/game/machinery/computer/skills.dm
@@ -309,19 +309,19 @@ What a mess.*/
switch(href_list["field"])
if("name")
if (istype(active1, /datum/data/record))
- var/t1 = reject_bad_name(input("Please input name:", "Secure. records", active1.fields["name"], null) as text)
+ var/t1 = sanitizeName(input("Please input name:", "Secure. records", active1.fields["name"], null) as text)
if ((!( t1 ) || !length(trim(t1)) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon)))) || active1 != a1)
return
active1.fields["name"] = t1
if("id")
if (istype(active1, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input id:", "Secure. records", active1.fields["id"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input id:", "Secure. records", active1.fields["id"], null) as text)
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1))
return
active1.fields["id"] = t1
if("fingerprint")
if (istype(active1, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text)
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1))
return
active1.fields["fingerprint"] = t1
@@ -350,7 +350,7 @@ What a mess.*/
alert(usr, "You do not have the required rank to do this!")
if("species")
if (istype(active1, /datum/data/record))
- var/t1 = trim(sanitize(copytext(input("Please enter race:", "General records", active1.fields["species"], null) as message,1,MAX_MESSAGE_LEN)))
+ var/t1 = sanitize(input("Please enter race:", "General records", active1.fields["species"], null) as message)
if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active1 != a1))
return
active1.fields["species"] = t1
diff --git a/code/game/machinery/computer/supply.dm b/code/game/machinery/computer/supply.dm
index e27813ccf6..233a271108 100644
--- a/code/game/machinery/computer/supply.dm
+++ b/code/game/machinery/computer/supply.dm
@@ -85,7 +85,7 @@
if(!istype(P)) return
var/timeout = world.time + 600
- var/reason = sanitize(copytext(input(usr,"Reason:","Why do you require this item?","") as null|text,1,MAX_MESSAGE_LEN))
+ var/reason = sanitize(input(usr,"Reason:","Why do you require this item?","") as null|text)
if(world.time > timeout) return
if(!reason) return
@@ -289,7 +289,7 @@
if(!istype(P)) return
var/timeout = world.time + 600
- var/reason = sanitize(copytext(input(usr,"Reason:","Why do you require this item?","") as null|text,1,MAX_MESSAGE_LEN))
+ var/reason = sanitize(input(usr,"Reason:","Why do you require this item?","") as null|text)
if(world.time > timeout) return
if(!reason) return
diff --git a/code/game/machinery/computer3/computers/card.dm b/code/game/machinery/computer3/computers/card.dm
index 963b1f4de7..3633252a46 100644
--- a/code/game/machinery/computer3/computers/card.dm
+++ b/code/game/machinery/computer3/computers/card.dm
@@ -304,7 +304,7 @@
if(auth)
var/t1 = href_list["assign"]
if(t1 == "Custom")
- var/temp_t = sanitize(copytext(input("Enter a custom job assignment.","Assignment"),1,MAX_MESSAGE_LEN))
+ var/temp_t = sanitize(input("Enter a custom job assignment.","Assignment"))
if(temp_t)
t1 = temp_t
set_default_access(t1)
diff --git a/code/game/machinery/computer3/computers/communications.dm b/code/game/machinery/computer3/computers/communications.dm
index 527a2e2c5a..f00b595c6c 100644
--- a/code/game/machinery/computer3/computers/communications.dm
+++ b/code/game/machinery/computer3/computers/communications.dm
@@ -178,10 +178,10 @@
post_status(href_list["statdisp"])
if("setmsg1" in href_list)
- stat_msg1 = reject_bad_text(trim(sanitize(copytext(input("Line 1", "Enter Message Text", stat_msg1) as text|null, 1, 40)), 40))
+ stat_msg1 = reject_bad_text(sanitize(input("Line 1", "Enter Message Text", stat_msg1) as text|null, 40), 40)
computer.updateDialog()
if("setmsg2" in href_list)
- stat_msg2 = reject_bad_text(trim(sanitize(copytext(input("Line 2", "Enter Message Text", stat_msg2) as text|null, 1, 40)), 40))
+ stat_msg2 = reject_bad_text(sanitize(input("Line 2", "Enter Message Text", stat_msg2) as text|null, 40), 40)
computer.updateDialog()
// OMG CENTCOMM LETTERHEAD
@@ -192,7 +192,7 @@
if(centcomm_message_cooldown)
usr << "Arrays recycling. Please stand by."
return
- var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
+ var/input = sanitize(input("Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", ""))
if(!input || !interactable())
return
Centcomm_announce(input, usr)
@@ -209,7 +209,7 @@
if(centcomm_message_cooldown)
usr << "Arrays recycling. Please stand by."
return
- var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
+ var/input = sanitize(input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", ""))
if(!input || !interactable())
return
Syndicate_announce(input, usr)
diff --git a/code/game/machinery/computer3/computers/medical.dm b/code/game/machinery/computer3/computers/medical.dm
index 42fcb9e5e7..adb7ff9079 100644
--- a/code/game/machinery/computer3/computers/medical.dm
+++ b/code/game/machinery/computer3/computers/medical.dm
@@ -92,7 +92,7 @@
var/icon/side = active1.fields["photo_side"]
usr << browse_rsc(front, "front.png")
usr << browse_rsc(side, "side.png")
-
+
dat += "
| Name: [active1.fields["name"]] \
ID: [active1.fields["id"]] \n \ Sex: [active1.fields["sex"]] \n \ @@ -264,7 +264,7 @@ switch(href_list["field"]) if("fingerprint") if (istype(src.active1, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please input fingerprint hash:", "Med. records", src.active1.fields["fingerprint"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input fingerprint hash:", "Med. records", src.active1.fields["fingerprint"], null) as text) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active1 != a1)) return src.active1.fields["fingerprint"] = t1 @@ -282,55 +282,55 @@ src.active1.fields["age"] = t1 if("mi_dis") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please input minor disabilities list:", "Med. records", src.active2.fields["mi_dis"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input minor disabilities list:", "Med. records", src.active2.fields["mi_dis"], null) as text) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["mi_dis"] = t1 if("mi_dis_d") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please summarize minor dis.:", "Med. records", src.active2.fields["mi_dis_d"], null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize minor dis.:", "Med. records", src.active2.fields["mi_dis_d"], null) as message) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["mi_dis_d"] = t1 if("ma_dis") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please input major diabilities list:", "Med. records", src.active2.fields["ma_dis"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input major diabilities list:", "Med. records", src.active2.fields["ma_dis"], null) as text) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["ma_dis"] = t1 if("ma_dis_d") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please summarize major dis.:", "Med. records", src.active2.fields["ma_dis_d"], null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize major dis.:", "Med. records", src.active2.fields["ma_dis_d"], null) as message) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["ma_dis_d"] = t1 if("alg") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please state allergies:", "Med. records", src.active2.fields["alg"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please state allergies:", "Med. records", src.active2.fields["alg"], null) as text) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["alg"] = t1 if("alg_d") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please summarize allergies:", "Med. records", src.active2.fields["alg_d"], null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize allergies:", "Med. records", src.active2.fields["alg_d"], null) as message) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["alg_d"] = t1 if("cdi") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please state diseases:", "Med. records", src.active2.fields["cdi"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please state diseases:", "Med. records", src.active2.fields["cdi"], null) as text) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["cdi"] = t1 if("cdi_d") if (istype(src.active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please summarize diseases:", "Med. records", src.active2.fields["cdi_d"], null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize diseases:", "Med. records", src.active2.fields["cdi_d"], null) as message) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["cdi_d"] = t1 if("notes") if (istype(src.active2, /datum/data/record)) - var/t1 = html_encode(trim(copytext(input("Please summarize notes:", "Med. records", html_decode(src.active2.fields["notes"]), null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize notes:", "Med. records", html_decode(src.active2.fields["notes"]), null) as message, extra = 0) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["notes"] = t1 @@ -345,21 +345,21 @@ src.temp = text("Blood Type: \n\tA- A+ \n\tB- B+ \n\tAB- AB+ \n\tO- O+ ", src, src, src, src, src, src, src, src) if("b_dna") if (istype(src.active2, /datum/data/record)) - var/t1 = sanitize(copytext(trim(input("Please input DNA hash:", "Med. records", src.active2.fields["b_dna"], null) as text),1,MAX_MESSAGE_LEN)) + var/t1 = sanitize(input("Please input DNA hash:", "Med. records", src.active2.fields["b_dna"], null) as text) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return src.active2.fields["b_dna"] = t1 if("vir_name") var/datum/data/record/v = locate(href_list["edit_vir"]) if (v) - var/t1 = trim(sanitize(copytext(input("Please input pathogen name:", "VirusDB", v.fields["name"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input pathogen name:", "VirusDB", v.fields["name"], null) as text) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active1 != a1)) return v.fields["name"] = t1 if("vir_desc") var/datum/data/record/v = locate(href_list["edit_vir"]) if (v) - var/t1 = trim(sanitize(copytext(input("Please input information about pathogen:", "VirusDB", v.fields["description"], null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input information about pathogen:", "VirusDB", v.fields["description"], null) as message) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active1 != a1)) return v.fields["description"] = t1 @@ -464,7 +464,7 @@ if (!( istype(src.active2, /datum/data/record) )) return var/a2 = src.active2 - var/t1 = sanitize(copytext(input("Add Comment:", "Med. records", null, null) as message,1,MAX_MESSAGE_LEN)) + var/t1 = sanitize(input("Add Comment:", "Med. records", null, null) as message) if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return var/counter = 1 diff --git a/code/game/machinery/computer3/computers/prisoner.dm b/code/game/machinery/computer3/computers/prisoner.dm index 7b0c97d4ae..49f1940d75 100644 --- a/code/game/machinery/computer3/computers/prisoner.dm +++ b/code/game/machinery/computer3/computers/prisoner.dm @@ -90,7 +90,7 @@ screen = !screen else if(href_list["warn"]) - var/warning = trim(sanitize(copytext(input(usr,"Message:","Enter your message here!",""),1,MAX_MESSAGE_LEN))) + var/warning = sanitize(input(usr,"Message:","Enter your message here!","")) if(!warning) return var/obj/item/weapon/implant/I = locate(href_list["warn"]) if( istype(I) && I.imp_in) diff --git a/code/game/machinery/computer3/computers/security.dm b/code/game/machinery/computer3/computers/security.dm index f630b24175..924f32b1b7 100644 --- a/code/game/machinery/computer3/computers/security.dm +++ b/code/game/machinery/computer3/computers/security.dm @@ -404,7 +404,7 @@ What a mess.*/ if (!( istype(active2, /datum/data/record) )) return var/a2 = active2 - var/t1 = sanitize(copytext(input("Add Comment:", "Secure. records", null, null) as message,1,MAX_MESSAGE_LEN)) + var/t1 = sanitize(input("Add Comment:", "Secure. records", null, null) as message) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active2 != a2)) return var/counter = 1 @@ -444,19 +444,19 @@ What a mess.*/ switch(href_list["field"]) if("name") if (istype(active1, /datum/data/record)) - var/t1 = reject_bad_name(input("Please input name:", "Secure. records", active1.fields["name"], null) as text) + var/t1 = sanitizeName(input("Please input name:", "Secure. records", active1.fields["name"], null) as text) if ((!( t1 ) || !length(trim(t1)) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon)))) || active1 != a1) return active1.fields["name"] = t1 if("id") if (istype(active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please input id:", "Secure. records", active1.fields["id"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input id:", "Secure. records", active1.fields["id"], null) as text) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active1 != a1)) return active1.fields["id"] = t1 if("fingerprint") if (istype(active1, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null) as text) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active1 != a1)) return active1.fields["fingerprint"] = t1 @@ -474,31 +474,31 @@ What a mess.*/ active1.fields["age"] = t1 if("mi_crim") if (istype(active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please input minor disabilities list:", "Secure. records", active2.fields["mi_crim"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input minor disabilities list:", "Secure. records", active2.fields["mi_crim"], null) as text) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active2 != a2)) return active2.fields["mi_crim"] = t1 if("mi_crim_d") if (istype(active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please summarize minor dis.:", "Secure. records", active2.fields["mi_crim_d"], null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize minor dis.:", "Secure. records", active2.fields["mi_crim_d"], null) as message) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active2 != a2)) return active2.fields["mi_crim_d"] = t1 if("ma_crim") if (istype(active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please input major diabilities list:", "Secure. records", active2.fields["ma_crim"], null) as text,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please input major diabilities list:", "Secure. records", active2.fields["ma_crim"], null) as text) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active2 != a2)) return active2.fields["ma_crim"] = t1 if("ma_crim_d") if (istype(active2, /datum/data/record)) - var/t1 = trim(sanitize(copytext(input("Please summarize major dis.:", "Secure. records", active2.fields["ma_crim_d"], null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize major dis.:", "Secure. records", active2.fields["ma_crim_d"], null) as message) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active2 != a2)) return active2.fields["ma_crim_d"] = t1 if("notes") if (istype(active2, /datum/data/record)) - var/t1 = html_encode(trim(copytext(input("Please summarize notes:", "Secure. records", html_decode(active2.fields["notes"]), null) as message,1,MAX_MESSAGE_LEN))) + var/t1 = sanitize(input("Please summarize notes:", "Secure. records", html_decode(active2.fields["notes"]), null) as message, extra = 0) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active2 != a2)) return active2.fields["notes"] = t1 @@ -525,7 +525,7 @@ What a mess.*/ alert(usr, "You do not have the required rank to do this!") if("species") if (istype(active1, /datum/data/record)) - var/t1 = sanitize(copytext(input("Please enter race:", "General records", active1.fields["species"], null) as message,1,MAX_MESSAGE_LEN)) + var/t1 = sanitize(input("Please enter race:", "General records", active1.fields["species"], null) as message) if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!interactable() && (!istype(usr, /mob/living/silicon))) || active1 != a1)) return active1.fields["species"] = t1 diff --git a/code/game/machinery/magnet.dm b/code/game/machinery/magnet.dm index 8569ede3fd..b04e9d1851 100644 --- a/code/game/machinery/magnet.dm +++ b/code/game/machinery/magnet.dm @@ -323,7 +323,7 @@ if(speed <= 0) speed = 1 if("setpath") - var/newpath = sanitize(copytext(input(usr, "Please define a new path!",,path) as text|null,1,MAX_MESSAGE_LEN)) + var/newpath = sanitize(input(usr, "Please define a new path!",,path) as text|null) if(newpath && newpath != "") moving = 0 // stop moving path = newpath diff --git a/code/game/machinery/navbeacon.dm b/code/game/machinery/navbeacon.dm index 56fcd1298e..de2a13aab5 100644 --- a/code/game/machinery/navbeacon.dm +++ b/code/game/machinery/navbeacon.dm @@ -194,7 +194,7 @@ Transponder Codes:
"} hear(var/msg) var/list/replacechars = list("'" = "","\"" = "",">" = "","<" = "","(" = "",")" = "") - msg = sanitize_simple(msg, replacechars) + msg = replace_characters(msg, replacechars) if(findtext(msg,phrase)) activate() del(src) @@ -206,7 +206,7 @@ Implant Specifics: "} elevel = alert("What sort of explosion would you prefer?", "Implant Intent", "Localized Limb", "Destroy Body", "Full Explosion") phrase = input("Choose activation phrase:") as text var/list/replacechars = list("'" = "","\"" = "",">" = "","<" = "","(" = "",")" = "") - phrase = sanitize_simple(phrase, replacechars) + phrase = replace_characters(phrase, replacechars) usr.mind.store_memory("Explosive implant in [source] can be activated by saying something containing the phrase ''[src.phrase]'', say [src.phrase] to attempt to activate.", 0, 0) usr << "The implanted explosive implant in [source] can be activated by saying something containing the phrase ''[src.phrase]'', say [src.phrase] to attempt to activate." return 1 diff --git a/code/game/objects/items/weapons/implants/implantcase.dm b/code/game/objects/items/weapons/implants/implantcase.dm index 00ce8a7950..ddb76b3656 100644 --- a/code/game/objects/items/weapons/implants/implantcase.dm +++ b/code/game/objects/items/weapons/implants/implantcase.dm @@ -26,7 +26,7 @@ return if((!in_range(src, usr) && src.loc != user)) return - t = sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + t = sanitize(t) if(t) src.name = text("Glass Case - '[]'", t) else diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index ec55e6549e..1b92926acd 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -135,7 +135,7 @@ /obj/structure/door_assembly/attackby(obj/item/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/pen)) - var/t = copytext(stripped_input(user, "Enter the name for the door.", src.name, src.created_name),1,MAX_NAME_LEN) + var/t = sanitizeSafe(input(user, "Enter the name for the door.", src.name, src.created_name), MAX_NAME_LEN) if(!t) return if(!in_range(src, usr) && src.loc != usr) return created_name = t diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 1a87fcede9..1f597b0c96 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -92,7 +92,7 @@ return if ((!in_range(src, usr) && src.loc != user)) return - t = sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + t = sanitize(t) if (t) src.name = text("Morgue- '[]'", t) else @@ -258,7 +258,7 @@ return if ((!in_range(src, usr) > 1 && src.loc != user)) return - t = sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + t = sanitize(t) if (t) src.name = text("Crematorium- '[]'", t) else diff --git a/code/game/response_team.dm b/code/game/response_team.dm index ea1a03a571..a64230b1d6 100644 --- a/code/game/response_team.dm +++ b/code/game/response_team.dm @@ -53,7 +53,7 @@ client/verb/JoinResponseTeam() for (var/obj/effect/landmark/L in landmarks_list) if (L.name == "Commando") L.name = null//Reserving the place. - var/new_name = input(usr, "Pick a name","Name") as null|text + var/new_name = sanitizeSafe(input(usr, "Pick a name","Name") as null|text, MAX_NAME_LEN) if(!new_name)//Somebody changed his mind, place is available again. L.name = "Commando" return diff --git a/code/game/verbs/ooc.dm b/code/game/verbs/ooc.dm index b8c124dcd8..92b0638b9f 100644 --- a/code/game/verbs/ooc.dm +++ b/code/game/verbs/ooc.dm @@ -12,7 +12,7 @@ src << "Guests may not use OOC." return - msg = trim(sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))) + msg = sanitize(msg) if(!msg) return if(!(prefs.toggles & CHAT_OOC)) @@ -77,7 +77,7 @@ src << "Guests may not use OOC." return - msg = trim(sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))) + msg = sanitize(msg) if(!msg) return if(!(prefs.toggles & CHAT_LOOC)) diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index 32e633a200..a361328cac 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -181,7 +181,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null) switch(param) if("reason") if(!value) - value = input("Insert the new reason for [pckey]'s ban", "New Reason", "[reason]", null) as null|text + value = sanitize(input("Insert the new reason for [pckey]'s ban", "New Reason", "[reason]", null) as null|text) value = sql_sanitize_text(value) if(!value) usr << "Cancelled" diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 78524320a7..96b7a7c244 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -725,10 +725,10 @@ var/global/floorIsLava = 0 set desc="Announce your desires to the world" if(!check_rights(0)) return - var/message = input("Global message to send:", "Admin Announce", null, null) as message + var/message = input("Global message to send:", "Admin Announce", null, null) as message//todo: sanitize for all? if(message) if(!check_rights(R_SERVER,0)) - message = adminscrub(message,500) + message = sanitize(message, 500, extra = 0) world << "\blue [usr.client.holder.fakekey ? "Administrator" : usr.key] Announces:\n \t [message]" log_admin("Announce: [key_name(usr)] : [message]") feedback_add_details("admin_verb","A") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/admin_memo.dm b/code/modules/admin/admin_memo.dm index 133f6d10e9..4bcaf10d9c 100644 --- a/code/modules/admin/admin_memo.dm +++ b/code/modules/admin/admin_memo.dm @@ -16,7 +16,7 @@ /client/proc/admin_memo_write() var/savefile/F = new(MEMOFILE) if(F) - var/memo = input(src,"Type your memo\n(Leaving it blank will delete your current memo):","Write Memo",null) as null|message + var/memo = sanitize(input(src,"Type your memo\n(Leaving it blank will delete your current memo):","Write Memo",null) as null|message, extra = 0) switch(memo) if(null) return diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 8176ca8418..1702fc4dbc 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -617,7 +617,7 @@ var/list/admin_verbs_mentor = list( set name = "Make Sound" set desc = "Display a message to everyone who can hear the target" if(O) - var/message = input("What do you want the message to be?", "Make Sound") as text|null + var/message = sanitize(input("What do you want the message to be?", "Make Sound") as text|null) if(!message) return for (var/mob/V in hearers(O)) @@ -709,7 +709,7 @@ var/list/admin_verbs_mentor = list( return if(holder) - var/new_name = trim_strip_input(src, "Enter new name. Leave blank or as is to cancel.", "Enter new silicon name", S.real_name) + var/new_name = sanitizeSafe(input(src, "Enter new name. Leave blank or as is to cancel.", "Enter new silicon name", S.real_name)) if(new_name && new_name != S.real_name) admin_log_and_message_admins("has renamed the silicon '[S.real_name]' to '[new_name]'") S.SetName(new_name) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 164cae6960..5ffd58353e 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -328,12 +328,12 @@ mins = min(525599,mins) minutes = CMinutes + mins duration = GetExp(minutes) - reason = input(usr,"Reason?","reason",reason2) as text|null + reason = sanitize(input(usr,"Reason?","reason",reason2) as text|null) if(!reason) return if("No") temp = 0 duration = "Perma" - reason = input(usr,"Reason?","reason",reason2) as text|null + reason = sanitize(input(usr,"Reason?","reason",reason2) as text|null) if(!reason) return log_admin("[key_name(usr)] edited [banned_key]'s ban. Reason: [reason] Duration: [duration]") @@ -655,7 +655,7 @@ var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null if(!mins) return - var/reason = input(usr,"Reason?","Please State Reason","") as text|null + var/reason = sanitize(input(usr,"Reason?","Please State Reason","") as text|null) if(!reason) return @@ -680,7 +680,7 @@ return 1 if("No") if(!check_rights(R_BAN)) return - var/reason = input(usr,"Reason?","Please State Reason","") as text|null + var/reason = sanitize(input(usr,"Reason?","Please State Reason","") as text|null) if(reason) var/msg for(var/job in notbannedlist) @@ -737,7 +737,7 @@ if (ismob(M)) if(!check_if_greater_rights_than(M.client)) return - var/reason = input("Please enter reason") + var/reason = sanitize(input("Please enter reason")) if(!reason) M << "\red You have been kicked from the server" else @@ -794,7 +794,7 @@ if(!mins) return if(mins >= 525600) mins = 525599 - var/reason = input(usr,"Reason?","reason","Griefer") as text|null + var/reason = sanitize(input(usr,"Reason?","reason","Griefer") as text|null) if(!reason) return AddBan(M.ckey, M.computer_id, reason, usr.ckey, 1, mins) @@ -815,7 +815,7 @@ //del(M) // See no reason why to delete mob. Important stuff can be lost. And ban can be lifted before round ends. if("No") if(!check_rights(R_BAN)) return - var/reason = input(usr,"Reason?","reason","Griefer") as text|null + var/reason = sanitize(input(usr,"Reason?","reason","Griefer") as text|null) if(!reason) return switch(alert(usr,"IP ban?",,"Yes","No","Cancel")) @@ -1341,7 +1341,7 @@ usr << "The person you are trying to contact is not wearing a headset" return - var/input = input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from Centcomm", "") + var/input = sanitize(input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from Centcomm", "")) if(!input) return src.owner << "You sent [input] to [H] via a secure channel." @@ -1358,7 +1358,7 @@ usr << "The person you are trying to contact is not wearing a headset" return - var/input = input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from a shadowy figure...", "") + var/input = sanitize(input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from a shadowy figure...", "")) if(!input) return src.owner << "You sent [input] to [H] via a secure channel." @@ -1405,6 +1405,7 @@ var/mob/sender = locate(href_list["CentcommFaxReply"]) var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["originfax"]) + //todo: sanitize var/input = input(src.owner, "Please enter a message to reply to [key_name(sender)] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use for line breaks.", "Outgoing message from Centcomm", "") as message|null if(!input) return @@ -2388,9 +2389,7 @@ src.access_news_network() else if(href_list["ac_set_channel_name"]) - src.admincaster_feed_channel.channel_name = strip_html_simple(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", "")) - while (findtext(src.admincaster_feed_channel.channel_name," ") == 1) - src.admincaster_feed_channel.channel_name = copytext(src.admincaster_feed_channel.channel_name,2,lentext(src.admincaster_feed_channel.channel_name)+1) + src.admincaster_feed_channel.channel_name = sanitizeSafe(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", "")) src.access_news_network() else if(href_list["ac_set_channel_lock"]) @@ -2423,13 +2422,11 @@ var/list/available_channels = list() for(var/datum/feed_channel/F in news_network.network_channels) available_channels += F.channel_name - src.admincaster_feed_channel.channel_name = adminscrub(input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels ) + src.admincaster_feed_channel.channel_name = sanitizeSafe(input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels ) src.access_news_network() else if(href_list["ac_set_new_message"]) - src.admincaster_feed_message.body = adminscrub(input(usr, "Write your Feed story", "Network Channel Handler", "")) - while (findtext(src.admincaster_feed_message.body," ") == 1) - src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,lentext(src.admincaster_feed_message.body)+1) + src.admincaster_feed_message.body = sanitize(input(usr, "Write your Feed story", "Network Channel Handler", "")) src.access_news_network() else if(href_list["ac_submit_new_message"]) @@ -2471,15 +2468,11 @@ src.access_news_network() else if(href_list["ac_set_wanted_name"]) - src.admincaster_feed_message.author = adminscrub(input(usr, "Provide the name of the Wanted person", "Network Security Handler", "")) - while (findtext(src.admincaster_feed_message.author," ") == 1) - src.admincaster_feed_message.author = copytext(admincaster_feed_message.author,2,lentext(admincaster_feed_message.author)+1) + src.admincaster_feed_message.author = sanitize(input(usr, "Provide the name of the Wanted person", "Network Security Handler", "")) src.access_news_network() else if(href_list["ac_set_wanted_desc"]) - src.admincaster_feed_message.body = adminscrub(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", "")) - while (findtext(src.admincaster_feed_message.body," ") == 1) - src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,lentext(src.admincaster_feed_message.body)+1) + src.admincaster_feed_message.body = sanitize(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", "")) src.access_news_network() else if(href_list["ac_submit_wanted"]) @@ -2584,7 +2577,7 @@ src.access_news_network() else if(href_list["ac_set_signature"]) - src.admincaster_signature = adminscrub(input(usr, "Provide your desired signature", "Network Identity Handler", "")) + src.admincaster_signature = sanitize(input(usr, "Provide your desired signature", "Network Identity Handler", "")) src.access_news_network() else if(href_list["populate_inactive_customitems"]) @@ -2622,7 +2615,7 @@ if(href_list["add_player_info"]) var/key = href_list["add_player_info"] - var/add = input("Add Player Info") as null|text + var/add = sanitize(input("Add Player Info") as null|text) if(!add) return notes_add(key,add,usr) diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index bff2372aa9..9f29bc621a 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -23,7 +23,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," //clean the input msg if(!msg) return - msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) + msg = sanitize(msg) if(!msg) return var/original_msg = msg @@ -88,7 +88,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey"," if(ai_found) ai_cl = " (CL)" - //Options bar: mob, details ( admin = 2, dev = 3, mentor = 4, character name (0 = just ckey, 1 = ckey and character name), link? (0 no don't make it a link, 1 do so), + //Options bar: mob, details ( admin = 2, dev = 3, mentor = 4, character name (0 = just ckey, 1 = ckey and character name), link? (0 no don't make it a link, 1 do so), // highlight special roles (0 = everyone has same looking name, 1 = antags / special roles get a golden name) var/mentor_msg = "\blue Request for Help: [get_options_bar(mob, 4, 1, 1, 0)][ai_cl]: [msg]" diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index 1c358c8cf4..467083e827 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -60,8 +60,9 @@ return //clean the message if it's not sent by a high-rank admin + //todo: sanitize for all??? if(!check_rights(R_SERVER|R_DEBUG,0)) - msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN)) + msg = sanitize(msg) if(!msg) return var/recieve_pm_type = "Player" @@ -91,7 +92,7 @@ spawn(0) //so we don't hold the caller proc up var/sender = src var/sendername = key - var/reply = input(C, msg,"[recieve_pm_type] PM from [sendername]", "") as text|null //show message and await a reply + var/reply = sanitize(input(C, msg,"[recieve_pm_type] PM from [sendername]", "") as text|null) //show message and await a reply if(C && reply) if(sender) C.cmd_admin_pm(sender,reply) //sender is still about, let's reply to them diff --git a/code/modules/admin/verbs/adminsay.dm b/code/modules/admin/verbs/adminsay.dm index e3aa767ecd..fdbbe8d4e1 100644 --- a/code/modules/admin/verbs/adminsay.dm +++ b/code/modules/admin/verbs/adminsay.dm @@ -4,7 +4,7 @@ set hidden = 1 if(!check_rights(R_ADMIN)) return - msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN)) + msg = sanitize(msg) if(!msg) return log_admin("[key_name(src)] : [msg]") @@ -23,7 +23,7 @@ if(!check_rights(R_ADMIN|R_MOD|R_MENTOR)) return - msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN)) + msg = sanitize(msg) log_admin("MOD: [key_name(src)] : [msg]") if (!msg) diff --git a/code/modules/admin/verbs/antag-ooc.dm b/code/modules/admin/verbs/antag-ooc.dm index 82e81c0595..53a2c709fc 100644 --- a/code/modules/admin/verbs/antag-ooc.dm +++ b/code/modules/admin/verbs/antag-ooc.dm @@ -5,7 +5,7 @@ if(!check_rights(R_ADMIN)) return - msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN)) + msg = sanitize(msg) if(!msg) return var/display_name = src.key diff --git a/code/modules/admin/verbs/custom_event.dm b/code/modules/admin/verbs/custom_event.dm index 3021cc2828..265c16a868 100644 --- a/code/modules/admin/verbs/custom_event.dm +++ b/code/modules/admin/verbs/custom_event.dm @@ -7,7 +7,7 @@ src << "Only administrators may use this command." return - var/input = input(usr, "Enter the description of the custom event. Be descriptive. To cancel the event, make this blank or hit cancel.", "Custom Event", custom_event_msg) as message|null + var/input = sanitize(input(usr, "Enter the description of the custom event. Be descriptive. To cancel the event, make this blank or hit cancel.", "Custom Event", custom_event_msg) as message|null, MAX_BOOK_MESSAGE_LEN, extra = 0) if(!input || input == "") custom_event_msg = null log_admin("[usr.key] has cleared the custom event text.") @@ -21,7 +21,7 @@ world << " Custom Event" world << "A custom event is starting. OOC Info:" - world << "[html_encode(custom_event_msg)]" + world << "[custom_event_msg]" world << "" // normal verb for players to view info @@ -36,5 +36,5 @@ src << " Custom Event" src << "A custom event is taking place. OOC Info:" - src << "[html_encode(custom_event_msg)]" + src << "[custom_event_msg]" src << "" diff --git a/code/modules/admin/verbs/deadsay.dm b/code/modules/admin/verbs/deadsay.dm index bb66843c16..b3b6e3fdae 100644 --- a/code/modules/admin/verbs/deadsay.dm +++ b/code/modules/admin/verbs/deadsay.dm @@ -29,7 +29,7 @@ if (src.holder.rights & R_ADMIN) stafftype = "ADMIN" - msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN)) + msg = sanitize(msg) log_admin("[key_name(src)] : [msg]") if (!msg) diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 4e4ed552d2..b9858aa7d5 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -205,7 +205,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that return 0 var/obj/item/device/paicard/card = new(T) var/mob/living/silicon/pai/pai = new(card) - pai.name = input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text + pai.name = sanitizeSafe(input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text) pai.real_name = pai.name pai.key = choice.key card.setPersonality(pai) diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm index a35fb15174..a6b4bf7d16 100644 --- a/code/modules/admin/verbs/massmodvar.dm +++ b/code/modules/admin/verbs/massmodvar.dm @@ -168,7 +168,7 @@ return .(O.vars[variable]) if("text") - var/new_value = input("Enter new text:","Text",O.vars[variable]) as text|null + var/new_value = input("Enter new text:","Text",O.vars[variable]) as text|null//todo: sanitize ??? if(new_value == null) return O.vars[variable] = new_value diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 8c48af6a45..fce2aa59dc 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -44,7 +44,7 @@ var/list/forbidden_varedit_object_types = list( switch(class) if("text") - var_value = input("Enter new text:","Text") as null|text + var_value = input("Enter new text:","Text") as null|text//todo: sanitize ??? if("num") var_value = input("Enter new number:","Num") as null|num @@ -93,7 +93,7 @@ var/list/forbidden_varedit_object_types = list( switch(class) if("text") - var_value = input("Enter new text:","Text") as text + var_value = input("Enter new text:","Text") as text//todo: sanitize ??? if("num") var_value = input("Enter new number:","Num") as num @@ -243,7 +243,7 @@ var/list/forbidden_varedit_object_types = list( return if("text") - L[L.Find(variable)] = input("Enter new text:","Text") as text + L[L.Find(variable)] = input("Enter new text:","Text") as text//todo: sanitize ??? if("num") L[L.Find(variable)] = input("Enter new number:","Num") as num @@ -450,7 +450,7 @@ var/list/forbidden_varedit_object_types = list( return .(O.vars[variable]) if("text") - var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|text + var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|text//todo: sanitize ??? if(var_new==null) return O.vars[variable] = var_new diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index 6e79bbbc3f..8b2d070003 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -6,7 +6,7 @@ usr << "\red Speech is currently admin-disabled." return - msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN)) + msg = sanitize(msg) if(!msg) return if(usr.client) @@ -29,14 +29,14 @@ //log_admin("HELP: [key_name(src)]: [msg]") /proc/Centcomm_announce(var/text , var/mob/Sender , var/iamessage) - var/msg = sanitize(copytext(text, 1, MAX_MESSAGE_LEN)) + var/msg = sanitize(text) msg = "\blue CENTCOMM[iamessage ? " IA" : ""]:[key_name(Sender, 1)] (PP) (VV) (SM) (JMP) (CA) (BSA) (RPLY): [msg]" for(var/client/C in admins) if(R_ADMIN & C.holder.rights) C << msg /proc/Syndicate_announce(var/text , var/mob/Sender) - var/msg = sanitize(copytext(text, 1, MAX_MESSAGE_LEN)) + var/msg = sanitize(text) msg = "\blue ILLEGAL:[key_name(Sender, 1)] (PP) (VV) (SM) (JMP) (CA) (BSA) (RPLY): [msg]" for(var/client/C in admins) if(R_ADMIN & C.holder.rights) diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index 4ea4ad998b..64e44e17e9 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -52,7 +52,7 @@ src << "Only administrators may use this command." return - var/msg = input("Message:", text("Subtle PM to [M.key]")) as text + var/msg = sanitize(input("Message:", text("Subtle PM to [M.key]")) as text) if (!msg) return @@ -109,7 +109,7 @@ src << "Only administrators may use this command." return - var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text + var/msg = sanitize(input("Message:", text("Enter the text you wish to appear to everyone:")) as text) if (!msg) return @@ -132,7 +132,7 @@ if(!M) return - var/msg = input("Message:", text("Enter the text you wish to appear to your target:")) as text + var/msg = sanitize(input("Message:", text("Enter the text you wish to appear to your target:")) as text) if( !msg ) return @@ -462,7 +462,7 @@ Traitors and the like can also be revived with the previous role mostly intact. if(!holder) src << "Only administrators may use this command." return - var/input = input(usr, "Please enter anything you want the AI to do. Anything. Serious.", "What?", "") as text|null + var/input = sanitize(input(usr, "Please enter anything you want the AI to do. Anything. Serious.", "What?", "") as text|null) if(!input) return for(var/mob/living/silicon/ai/M in mob_list) @@ -510,8 +510,8 @@ Traitors and the like can also be revived with the previous role mostly intact. if(!holder) src << "Only administrators may use this command." return - var/input = input(usr, "Please enter anything you want. Anything. Serious.", "What?", "") as message|null - var/customname = input(usr, "Pick a title for the report.", "Title") as text|null + var/input = sanitize(input(usr, "Please enter anything you want. Anything. Serious.", "What?", "") as message|null, extra = 0) + var/customname = sanitizeSafe(input(usr, "Pick a title for the report.", "Title") as text|null) if(!input) return if(!customname) diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm index c12d76b68d..c49e09d554 100644 --- a/code/modules/admin/verbs/striketeam.dm +++ b/code/modules/admin/verbs/striketeam.dm @@ -43,7 +43,7 @@ var/const/commandos_possible = 6 //if more Commandos are needed in the future choice = null while(!choice) - choice = sanitize(copytext(input(src, "Please specify which mission the strike team shall undertake.", "Specify Mission", ""),1,MAX_MESSAGE_LEN)) + choice = sanitize(input(src, "Please specify which mission the strike team shall undertake.", "Specify Mission", "")) if(!choice) if(alert("Error, no mission set. Do you want to exit the setup process?",,"Yes","No")=="Yes") return diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index a8efe68418..45ca127f13 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -145,7 +145,7 @@ if(custom_event_msg && custom_event_msg != "") src << " Custom Event" src << "A custom event is taking place. OOC Info:" - src << "[html_encode(custom_event_msg)]" + src << "[custom_event_msg]" src << "" if( (world.address == address || !address) && !host ) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 6317a5a6a0..493b681be3 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -995,16 +995,10 @@ datum/preferences ShowChoices(user) return if("general") - var/msg = input(usr,"Give a general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message - if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) + var/msg = sanitize(input(usr,"Give a general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message, extra = 0) flavor_texts[href_list["task"]] = msg else - var/msg = input(usr,"Set the flavor text for your [href_list["task"]].","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message - if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) + var/msg = sanitize(input(usr,"Set the flavor text for your [href_list["task"]].","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message, extra = 0) flavor_texts[href_list["task"]] = msg SetFlavorText(user) return @@ -1019,16 +1013,10 @@ datum/preferences ShowChoices(user) return if("Default") - var/msg = input(usr,"Set the default flavour text for your robot. It will be used for any module without individual setting.","Flavour Text",html_decode(flavour_texts_robot["Default"])) as message - if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) + var/msg = sanitize(input(usr,"Set the default flavour text for your robot. It will be used for any module without individual setting.","Flavour Text",html_decode(flavour_texts_robot["Default"])) as message, extra = 0) flavour_texts_robot[href_list["task"]] = msg else - var/msg = input(usr,"Set the flavour text for your robot with [href_list["task"]] module. If you leave this empty, default flavour text will be used for this module.","Flavour Text",html_decode(flavour_texts_robot[href_list["task"]])) as message - if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) + var/msg = sanitize(input(usr,"Set the flavour text for your robot with [href_list["task"]] module. If you leave this empty, default flavour text will be used for this module.","Flavour Text",html_decode(flavour_texts_robot[href_list["task"]])) as message, extra = 0) flavour_texts_robot[href_list["task"]] = msg SetFlavourTextRobot(user) return @@ -1044,41 +1032,25 @@ datum/preferences else user << browse(null, "window=records") if(href_list["task"] == "med_record") - var/medmsg = input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message - + var/medmsg = sanitize(input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0) if(medmsg != null) - medmsg = copytext(medmsg, 1, MAX_PAPER_MESSAGE_LEN) - medmsg = html_encode(medmsg) - med_record = medmsg SetRecords(user) if(href_list["task"] == "sec_record") - var/secmsg = input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message - + var/secmsg = sanitize(input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0) if(secmsg != null) - secmsg = copytext(secmsg, 1, MAX_PAPER_MESSAGE_LEN) - secmsg = html_encode(secmsg) - sec_record = secmsg SetRecords(user) if(href_list["task"] == "gen_record") - var/genmsg = input(usr,"Set your employment notes here.","Employment Records",html_decode(gen_record)) as message - + var/genmsg = sanitize(input(usr,"Set your employment notes here.","Employment Records",html_decode(gen_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0) if(genmsg != null) - genmsg = copytext(genmsg, 1, MAX_PAPER_MESSAGE_LEN) - genmsg = html_encode(genmsg) - gen_record = genmsg SetRecords(user) if(href_list["task"] == "exploitable_record") - var/exploitmsg = input(usr,"Set exploitable information about you here.","Exploitable Information",html_decode(exploit_record)) as message - + var/exploitmsg = sanitize(input(usr,"Set exploitable information about you here.","Exploitable Information",html_decode(exploit_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0) if(exploitmsg != null) - exploitmsg = copytext(exploitmsg, 1, MAX_PAPER_MESSAGE_LEN) - exploitmsg = html_encode(exploitmsg) - exploit_record = exploitmsg SetAntagoptions(user) @@ -1205,7 +1177,7 @@ datum/preferences if("name") var/raw_name = input(user, "Choose your character's name:", "Character Preference") as text|null if (!isnull(raw_name)) // Check to ensure that the user entered text (rather than cancel.) - var/new_name = reject_bad_name(raw_name) + var/new_name = sanitizeName(raw_name) if(new_name) real_name = new_name else @@ -1291,7 +1263,7 @@ datum/preferences if("metadata") var/new_metadata = input(user, "Enter any information you'd like others to see, such as Roleplay-preferences:", "Game Preference" , metadata) as message|null if(new_metadata) - metadata = sanitize(copytext(new_metadata,1,MAX_MESSAGE_LEN)) + metadata = sanitize(new_metadata) if("b_type") var/new_b_type = input(user, "Choose your character's blood-type:", "Character Preference") as null|anything in list( "A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-" ) @@ -1504,7 +1476,7 @@ datum/preferences if(choice == "Other") var/raw_choice = input(user, "Please enter a home system.") as text|null if(raw_choice) - home_system = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN)) + home_system = sanitize(raw_choice) return home_system = choice if("citizenship") @@ -1514,7 +1486,7 @@ datum/preferences if(choice == "Other") var/raw_choice = input(user, "Please enter your current citizenship.", "Character Preference") as text|null if(raw_choice) - citizenship = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN)) + citizenship = sanitize(raw_choice) return citizenship = choice if("faction") @@ -1524,7 +1496,7 @@ datum/preferences if(choice == "Other") var/raw_choice = input(user, "Please enter a faction.") as text|null if(raw_choice) - faction = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN)) + faction = sanitize(raw_choice) return faction = choice if("religion") @@ -1534,7 +1506,7 @@ datum/preferences if(choice == "Other") var/raw_choice = input(user, "Please enter a religon.") as text|null if(raw_choice) - religion = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN)) + religion = sanitize(raw_choice) return religion = choice else diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 76b25c9659..f3d46739f2 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -187,7 +187,7 @@ //Sanitize metadata = sanitize_text(metadata, initial(metadata)) - real_name = reject_bad_name(real_name) + real_name = sanitizeName(real_name) if(isnull(species) || !(species in playable_species)) species = "Human" diff --git a/code/modules/clothing/masks/voice.dm b/code/modules/clothing/masks/voice.dm index c30e1ea48b..6899fef1ef 100644 --- a/code/modules/clothing/masks/voice.dm +++ b/code/modules/clothing/masks/voice.dm @@ -21,7 +21,7 @@ set category = "Object" set src in usr - var/voice = sanitize(copytext(name,1,MAX_MESSAGE_LEN)) + var/voice = sanitize(name, MAX_NAME_LEN) if(!voice || !length(voice)) return changer.voice = voice usr << "You are now mimicking [changer.voice]." diff --git a/code/modules/clothing/spacesuits/rig/modules/utility.dm b/code/modules/clothing/spacesuits/rig/modules/utility.dm index 6568c3ca5d..b4a622075e 100644 --- a/code/modules/clothing/spacesuits/rig/modules/utility.dm +++ b/code/modules/clothing/spacesuits/rig/modules/utility.dm @@ -133,7 +133,7 @@ /obj/item/rig_module/chem_dispenser/ninja interface_desc = "Dispenses loaded chemicals directly into the wearer's bloodstream. This variant is made to be extremely light and flexible." - + //just over a syringe worth of each. Want more? Go refill. Gives the ninja another reason to have to show their face. charges = list( list("tricordrazine", "tricordrazine", 0, 20), @@ -280,10 +280,10 @@ voice_holder.active = 0 usr << "You disable the speech synthesiser." if("Set Name") - var/raw_choice = input(usr, "Please enter a new name.") as text|null + var/raw_choice = sanitize(input(usr, "Please enter a new name.") as text|null) if(!raw_choice) return 0 - voice_holder.voice = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN)) + voice_holder.voice = raw_choice usr << "You are now mimicking [voice_holder.voice]." return 1 diff --git a/code/modules/detectivework/scanning_console.dm b/code/modules/detectivework/scanning_console.dm index d9f3ac4df9..2dac51082d 100644 --- a/code/modules/detectivework/scanning_console.dm +++ b/code/modules/detectivework/scanning_console.dm @@ -222,7 +222,7 @@ if("logout") authenticated = 0 if("filter") - var/filterstr = stripped_input(usr,"Input the search criteria. Multiple values can be input, separated by a comma.", "Filter setting") as text|null + var/filterstr = sanitize(input("Input the search criteria. Multiple values can be input, separated by a comma.", "Filter setting") as text|null) if(filterstr) filters[href_list["filter"]] = text2list(filterstr,",") else @@ -243,7 +243,7 @@ current = null if("label") if(current) - var/label = stripped_input(usr,"Input the label for this record. Multiple values can be input, separated by a comma.", "Labeling record", current.fields["label"]) as text|null + var/label = sanitize(input(usr,"Input the label for this record. Multiple values can be input, separated by a comma.", "Labeling record", current.fields["label"]) as text|null) current.fields["label"] = label if("object") if(scanning) diff --git a/code/modules/economy/EFTPOS.dm b/code/modules/economy/EFTPOS.dm index c9f1aa1533..c2561423f4 100644 --- a/code/modules/economy/EFTPOS.dm +++ b/code/modules/economy/EFTPOS.dm @@ -167,7 +167,7 @@ if("change_id") var/attempt_code = text2num(input("Re-enter the current EFTPOS access code", "Confirm EFTPOS code")) if(attempt_code == access_code) - eftpos_name = input("Enter a new terminal ID for this device", "Enter new EFTPOS ID") + " EFTPOS scanner" + eftpos_name = sanitize(input("Enter a new terminal ID for this device", "Enter new EFTPOS ID")) + " EFTPOS scanner" print_reference() else usr << "\icon[src]Incorrect code entered." @@ -182,7 +182,7 @@ else usr << "\icon[src]Account not found." if("trans_purpose") - var/choice = input("Enter reason for EFTPOS transaction", "Transaction purpose") + var/choice = sanitize(input("Enter reason for EFTPOS transaction", "Transaction purpose")) if(choice) transaction_purpose = choice if("trans_value") var/try_num = input("Enter amount for EFTPOS transaction", "Transaction amount") as num diff --git a/code/modules/events/event_manager.dm b/code/modules/events/event_manager.dm index daa913a87c..d04eb6db31 100644 --- a/code/modules/events/event_manager.dm +++ b/code/modules/events/event_manager.dm @@ -233,7 +233,7 @@ else if(href_list["back"]) selected_event_container = null else if(href_list["set_name"]) - var/name = input("Enter event name.", "Set Name") as text|null + var/name = sanitize(input("Enter event name.", "Set Name") as text|null) if(name) var/datum/event_meta/EM = locate(href_list["set_name"]) EM.name = name diff --git a/code/modules/library/lib_items.dm b/code/modules/library/lib_items.dm index cd172b41ee..279be15775 100644 --- a/code/modules/library/lib_items.dm +++ b/code/modules/library/lib_items.dm @@ -31,11 +31,11 @@ O.loc = src update_icon() else if(istype(O, /obj/item/weapon/pen)) - var/newname = stripped_input(usr, "What would you like to title this bookshelf?") + var/newname = sanitizeSafe(input("What would you like to title this bookshelf?"), MAX_MESSAGE_LEN) if(!newname) return else - name = ("bookcase ([sanitize(newname)])") + name = ("bookcase ([newname])") else ..() @@ -174,7 +174,7 @@ var/choice = input("What would you like to change?") in list("Title", "Contents", "Author", "Cancel") switch(choice) if("Title") - var/newtitle = reject_bad_text(stripped_input(usr, "Write a new title:")) + var/newtitle = reject_bad_text(sanitizeSafe(input("Write a new title:"))) if(!newtitle) usr << "The title is invalid." return @@ -182,14 +182,14 @@ src.name = newtitle src.title = newtitle if("Contents") - var/content = strip_html(input(usr, "Write your book's contents (HTML NOT allowed):"),8192) as message|null + var/content = sanitize(input("Write your book's contents (HTML NOT allowed):") as message|null, MAX_BOOK_MESSAGE_LEN) if(!content) usr << "The content is invalid." return else src.dat += content if("Author") - var/newauthor = stripped_input(usr, "Write the author's name:") + var/newauthor = sanitize(input(usr, "Write the author's name:")) if(!newauthor) usr << "The name is invalid." return diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 8544543531..5d390948a3 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -300,12 +300,12 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f if(checkoutperiod < 1) checkoutperiod = 1 if(href_list["editbook"]) - buffer_book = sanitize(copytext(input("Enter the book's title:") as text|null,1,MAX_MESSAGE_LEN)) + buffer_book = sanitizeSafe(input("Enter the book's title:") as text|null) if(href_list["editmob"]) - buffer_mob = sanitize(copytext(input("Enter the recipient's name:") as text|null,1,MAX_NAME_LEN)) + buffer_mob = sanitize(input("Enter the recipient's name:") as text|null, MAX_NAME_LEN) if(href_list["checkout"]) var/datum/borrowbook/b = new /datum/borrowbook - b.bookname = sanitize(buffer_book) + b.bookname = sanitizeSafe(buffer_book) b.mobname = sanitize(buffer_mob) b.getdate = world.time b.duedate = world.time + (checkoutperiod * 600) @@ -317,7 +317,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f var/obj/item/weapon/book/b = locate(href_list["delbook"]) inventory.Remove(b) if(href_list["setauthor"]) - var/newauthor = sanitize(copytext(input("Enter the author's name: ") as text|null,1,MAX_MESSAGE_LEN)) + var/newauthor = sanitize(input("Enter the author's name: ") as text|null) if(newauthor) scanner.cache.author = newauthor if(href_list["setcategory"]) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index d352ee93a7..7b5f740135 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -533,7 +533,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp var/max_length = 50 - var/message = stripped_input(src,"Write a message. It cannot be longer than [max_length] characters.","Blood writing", "") + var/message = sanitize(input("Write a message. It cannot be longer than [max_length] characters.","Blood writing", "")) if (message) diff --git a/code/modules/mob/dead/observer/say.dm b/code/modules/mob/dead/observer/say.dm index b5b819950c..be9f1615e0 100644 --- a/code/modules/mob/dead/observer/say.dm +++ b/code/modules/mob/dead/observer/say.dm @@ -1,5 +1,5 @@ /mob/dead/observer/say(var/message) - message = strip_html_properly(message) + message = sanitize(message) if (!message) return @@ -18,7 +18,7 @@ /mob/dead/observer/emote(var/act, var/type, var/message) - message = trim_strip_html_properly(message) + message = sanitize(message) if(!message) return diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index 8862479b2a..5645773ea0 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -12,7 +12,7 @@ var/input if(!message) - input = sanitize(copytext(input(src,"Choose an emote to display.") as text|null,1,MAX_MESSAGE_LEN)) + input = sanitize(input(src,"Choose an emote to display.") as text|null) else input = message if(input) @@ -108,7 +108,7 @@ var/input if(!message) - input = sanitize(copytext(input(src, "Choose an emote to display.") as text|null, 1, MAX_MESSAGE_LEN)) + input = sanitize(input(src, "Choose an emote to display.") as text|null) else input = message diff --git a/code/modules/mob/living/carbon/alien/say.dm b/code/modules/mob/living/carbon/alien/say.dm index 038c77fcde..28ae01391f 100644 --- a/code/modules/mob/living/carbon/alien/say.dm +++ b/code/modules/mob/living/carbon/alien/say.dm @@ -7,7 +7,7 @@ src << "\red You cannot speak in IC (Muted)." return - message = trim_strip_html_properly(message) + message = sanitize(message) if(stat == 2) return say_dead(message) diff --git a/code/modules/mob/living/carbon/brain/say.dm b/code/modules/mob/living/carbon/brain/say.dm index e602916d8c..d5ac4f756d 100644 --- a/code/modules/mob/living/carbon/brain/say.dm +++ b/code/modules/mob/living/carbon/brain/say.dm @@ -32,5 +32,5 @@ if(istype(container, /obj/item/device/mmi/radio_enabled)) var/obj/item/device/mmi/radio_enabled/R = container if(R.radio) - spawn(0) R.radio.hear_talk(src, trim(sanitize(message)), verb, speaking) + spawn(0) R.radio.hear_talk(src, sanitize(message), verb, speaking) ..(trim(message), speaking, verb) diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 2140fe22b3..258c8cbcd1 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -50,7 +50,7 @@ m_type = 1 if ("custom") - var/input = sanitize(copytext(input("Choose an emote to display.") as text|null,1,MAX_MESSAGE_LEN)) + var/input = sanitize(input("Choose an emote to display.") as text|null) if (!input) return var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable") @@ -577,7 +577,7 @@ set desc = "Sets a description which will be shown when someone examines you." set category = "IC" - pose = sanitize(copytext(input(usr, "This is [src]. \He is...", "Pose", null) as text, 1, MAX_MESSAGE_LEN)) + pose = sanitize(input(usr, "This is [src]. \He is...", "Pose", null) as text) /mob/living/carbon/human/verb/set_flavor() set name = "Set Flavour Text" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index fd8be289e9..45e261792c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -501,7 +501,7 @@ for (var/datum/data/record/R in data_core.security) if (R.fields["id"] == E.fields["id"]) if(hasHUD(usr,"security")) - var/t1 = sanitize(copytext(input("Add Comment:", "Sec. records", null, null) as message,1,MAX_MESSAGE_LEN)) + var/t1 = sanitize(input("Add Comment:", "Sec. records", null, null) as message) if ( !(t1) || usr.stat || usr.restrained() || !(hasHUD(usr,"security")) ) return var/counter = 1 @@ -630,7 +630,7 @@ for (var/datum/data/record/R in data_core.medical) if (R.fields["id"] == E.fields["id"]) if(hasHUD(usr,"medical")) - var/t1 = sanitize(copytext(input("Add Comment:", "Med. records", null, null) as message,1,MAX_MESSAGE_LEN)) + var/t1 = sanitize(input("Add Comment:", "Med. records", null, null) as message) if ( !(t1) || usr.stat || usr.restrained() || !(hasHUD(usr,"medical")) ) return var/counter = 1 @@ -657,17 +657,11 @@ src << browse(null, "window=flavor_changes") return if("general") - var/msg = input(usr,"Update the general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(flavor_texts[href_list["flavor_change"]])) as message - if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) + var/msg = sanitize(input(usr,"Update the general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(flavor_texts[href_list["flavor_change"]])) as message, extra = 0) flavor_texts[href_list["flavor_change"]] = msg return else - var/msg = input(usr,"Update the flavor text for your [href_list["flavor_change"]].","Flavor Text",html_decode(flavor_texts[href_list["flavor_change"]])) as message - if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) + var/msg = sanitize(input(usr,"Update the flavor text for your [href_list["flavor_change"]].","Flavor Text",html_decode(flavor_texts[href_list["flavor_change"]])) as message, extra = 0) flavor_texts[href_list["flavor_change"]] = msg set_flavor() return @@ -1205,7 +1199,7 @@ var/max_length = bloody_hands * 30 //tweeter style - var/message = stripped_input(src,"Write a message. It cannot be longer than [max_length] characters.","Blood writing", "") + var/message = sanitize(input("Write a message. It cannot be longer than [max_length] characters.","Blood writing", "")) if (message) var/used_blood_amount = round(length(message) / 30, 1) diff --git a/code/modules/mob/living/carbon/human/human_powers.dm b/code/modules/mob/living/carbon/human/human_powers.dm index 1150a52e71..10988afb92 100644 --- a/code/modules/mob/living/carbon/human/human_powers.dm +++ b/code/modules/mob/living/carbon/human/human_powers.dm @@ -175,7 +175,7 @@ text = input("What would you like to say?", "Speak to creature", null, null) - text = trim(sanitize(copytext(text, 1, MAX_MESSAGE_LEN))) + text = sanitize(text) if(!text) return @@ -213,7 +213,7 @@ set desc = "Whisper silently to someone over a distance." set category = "Abilities" - var/msg = sanitize(copytext(input("Message:", "Psychic Whisper") as text|null, 1, MAX_MESSAGE_LEN)) + var/msg = sanitize(input("Message:", "Psychic Whisper") as text|null) if(msg) log_say("PsychicWhisper: [key_name(src)]->[M.key] : [msg]") M << "\green You hear a strange, alien voice in your head... \italic [msg]" diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm index 20c5183d72..120ce2086a 100644 --- a/code/modules/mob/living/carbon/human/say.dm +++ b/code/modules/mob/living/carbon/human/say.dm @@ -10,7 +10,7 @@ src << "\red You cannot speak in IC (Muted)." return - message = trim_strip_html_properly(message) + message = sanitize(message) if(stat) if(stat == 2) diff --git a/code/modules/mob/living/carbon/human/whisper.dm b/code/modules/mob/living/carbon/human/whisper.dm index 0c9882b215..2f67cbec85 100644 --- a/code/modules/mob/living/carbon/human/whisper.dm +++ b/code/modules/mob/living/carbon/human/whisper.dm @@ -6,7 +6,7 @@ usr << "\red Speech is currently admin-disabled." return - message = trim_strip_html_properly(message) + message = sanitize(message) log_whisper("[src.name]/[src.key] : [message]") if (src.client) diff --git a/code/modules/mob/living/carbon/metroid/items.dm b/code/modules/mob/living/carbon/metroid/items.dm index bce1679472..9f10399112 100644 --- a/code/modules/mob/living/carbon/metroid/items.dm +++ b/code/modules/mob/living/carbon/metroid/items.dm @@ -146,7 +146,7 @@ pet.colour = "[M.colour]" user <<"You feed the slime the potion, removing it's powers and calming it." del(M) - var/newname = sanitize(copytext(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text,1,MAX_NAME_LEN)) + var/newname = sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text, MAX_NAME_LEN) if (!newname) newname = "pet slime" @@ -177,7 +177,7 @@ pet.colour = "[M.colour]" user <<"You feed the slime the potion, removing it's powers and calming it." del(M) - var/newname = sanitize(copytext(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text,1,MAX_NAME_LEN)) + var/newname = sanitize(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text, MAX_NAME_LEN) if (!newname) newname = "pet slime" diff --git a/code/modules/mob/living/silicon/pai/recruit.dm b/code/modules/mob/living/silicon/pai/recruit.dm index f7814b77f3..195d58fb34 100644 --- a/code/modules/mob/living/silicon/pai/recruit.dm +++ b/code/modules/mob/living/silicon/pai/recruit.dm @@ -57,32 +57,32 @@ var/datum/paiController/paiController // Global handler for pAI candidates if("name") t = input("Enter a name for your pAI", "pAI Name", candidate.name) as text if(t) - candidate.name = sanitize(copytext(t,1,MAX_NAME_LEN)) + candidate.name = sanitizeSafe(t, MAX_NAME_LEN) if("desc") t = input("Enter a description for your pAI", "pAI Description", candidate.description) as message if(t) - candidate.description = sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + candidate.description = sanitize(t) if("role") t = input("Enter a role for your pAI", "pAI Role", candidate.role) as text if(t) - candidate.role = sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + candidate.role = sanitize(t) if("ooc") t = input("Enter any OOC comments", "pAI OOC Comments", candidate.comments) as message if(t) - candidate.comments = sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + candidate.comments = sanitize(t) if("save") candidate.savefile_save(usr) if("load") candidate.savefile_load(usr) //In case people have saved unsanitized stuff. if(candidate.name) - candidate.name = sanitize(copytext(candidate.name,1,MAX_NAME_LEN)) + candidate.name = sanitizeSafe(candidate.name, MAX_NAME_LEN) if(candidate.description) - candidate.description = sanitize(copytext(candidate.description,1,MAX_MESSAGE_LEN)) + candidate.description = sanitize(candidate.description) if(candidate.role) - candidate.role = sanitize(copytext(candidate.role,1,MAX_MESSAGE_LEN)) + candidate.role = sanitize(candidate.role) if(candidate.comments) - candidate.comments = sanitize(copytext(candidate.comments,1,MAX_MESSAGE_LEN)) + candidate.comments = sanitize(candidate.comments) if("submit") if(candidate) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 1fb0109a7f..9dd7472a3b 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -432,8 +432,8 @@ spawn(0) var/newname - newname = input(src,"You are a robot. Enter a name, or leave blank for the default name.", "Name change","") as text - if (newname != "") + newname = sanitizeSafe(input(src,"You are a robot. Enter a name, or leave blank for the default name.", "Name change","") as text, MAX_NAME_LEN) + if (newname) custom_name = newname updatename() diff --git a/code/modules/mob/living/silicon/robot/robot_items.dm b/code/modules/mob/living/silicon/robot/robot_items.dm index 33748f056e..0d40f0954a 100644 --- a/code/modules/mob/living/silicon/robot/robot_items.dm +++ b/code/modules/mob/living/silicon/robot/robot_items.dm @@ -124,11 +124,11 @@ /obj/item/weapon/pen/robopen/proc/RenamePaper(mob/user as mob,obj/paper as obj) if ( !user || !paper ) return - var/n_name = input(user, "What would you like to label the paper?", "Paper Labelling", null) as text + var/n_name = sanitizeSafe(input(user, "What would you like to label the paper?", "Paper Labelling", null) as text, 32) if ( !user || !paper ) return - n_name = copytext(n_name, 1, 32) + //n_name = copytext(n_name, 1, 32) if(( get_dist(user,paper) <= 1 && user.stat == 0)) paper.name = "paper[(n_name ? text("- '[n_name]'") : null)]" add_fingerprint(user) diff --git a/code/modules/mob/living/silicon/say.dm b/code/modules/mob/living/silicon/say.dm index 9fb93e0eff..ec6ddefe1c 100644 --- a/code/modules/mob/living/silicon/say.dm +++ b/code/modules/mob/living/silicon/say.dm @@ -34,7 +34,7 @@ if (src.client.handle_spam_prevention(message,MUTE_IC)) return 0 - message = trim_strip_html_properly(message) + message = sanitize(message) if (stat == 2) return say_dead(message) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index c210cecd9e..14b9183db8 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -235,14 +235,14 @@ set desc = "Sets a description which will be shown when someone examines you." set category = "IC" - pose = sanitize(copytext(input(usr, "This is [src]. It is...", "Pose", null) as text, 1, MAX_MESSAGE_LEN)) + pose = sanitize(input(usr, "This is [src]. It is...", "Pose", null) as text) /mob/living/silicon/verb/set_flavor() set name = "Set Flavour Text" set desc = "Sets an extended description of your character's features." set category = "IC" - flavor_text = sanitize(copytext(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text, 1)) + flavor_text = sanitize(input(usr, "Please enter your new flavour text.", "Flavour text", null) as text) /mob/living/silicon/binarycheck() return 1 diff --git a/code/modules/mob/living/simple_animal/borer/borer_captive.dm b/code/modules/mob/living/simple_animal/borer/borer_captive.dm index eacc058945..156d362773 100644 --- a/code/modules/mob/living/simple_animal/borer/borer_captive.dm +++ b/code/modules/mob/living/simple_animal/borer/borer_captive.dm @@ -14,7 +14,7 @@ if(istype(src.loc,/mob/living/simple_animal/borer)) - message = trim_strip_html_properly(message) + message = sanitize(message) if (!message) return log_say("[key_name(src)] : [message]") diff --git a/code/modules/mob/living/simple_animal/borer/say.dm b/code/modules/mob/living/simple_animal/borer/say.dm index 5b52a5b473..a5e5a34d58 100644 --- a/code/modules/mob/living/simple_animal/borer/say.dm +++ b/code/modules/mob/living/simple_animal/borer/say.dm @@ -1,6 +1,6 @@ /mob/living/simple_animal/borer/say(var/message) - message = trim_strip_html_properly(message) + message = sanitize(message) message = capitalize(message) if(!message) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 98768bfd41..4379db6c17 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -360,12 +360,9 @@ var/list/slot_equipment_priority = list( \ set src in usr if(usr != src) usr << "No." - var/msg = input(usr,"Set the flavor text in your 'examine' verb. Can also be used for OOC notes about your character.","Flavor Text",html_decode(flavor_text)) as message|null + var/msg = sanitize(input(usr,"Set the flavor text in your 'examine' verb. Can also be used for OOC notes about your character.","Flavor Text",html_decode(flavor_text)) as message|null, extra = 0) if(msg != null) - msg = copytext(msg, 1, MAX_MESSAGE_LEN) - msg = html_encode(msg) - flavor_text = msg /mob/proc/warn_flavor_changed() diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 4deb43a3c2..8c37c0cae1 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -342,7 +342,7 @@ proc/slur(phrase) n_letter = text("[n_letter]-[n_letter]") t = text("[t][n_letter]")//since the above is ran through for each letter, the text just adds up back to the original word. p++//for each letter p is increased to find where the next letter will be. - return sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + return sanitize(t) proc/Gibberish(t, p)//t is the inputted message, and any value higher than 70 for p will cause letters to be replaced instead of added @@ -389,7 +389,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp n_letter = text("[n_letter]") t = text("[t][n_letter]") p=p+n_mod - return sanitize(copytext(t,1,MAX_MESSAGE_LEN)) + return sanitize(t) /proc/shake_camera(mob/M, duration, strength=1) diff --git a/code/modules/mob/say.dm b/code/modules/mob/say.dm index 998c241498..899d0a9c9b 100644 --- a/code/modules/mob/say.dm +++ b/code/modules/mob/say.dm @@ -36,7 +36,7 @@ usr << "\red Speech is currently admin-disabled." return - message = strip_html_properly(message) + message = sanitize(message) set_typing_indicator(0) if(use_me) diff --git a/code/modules/nano/modules/law_manager.dm b/code/modules/nano/modules/law_manager.dm index a152411283..faccc5fdc3 100644 --- a/code/modules/nano/modules/law_manager.dm +++ b/code/modules/nano/modules/law_manager.dm @@ -77,25 +77,25 @@ return 1 if(href_list["change_zeroth_law"]) - var/new_law = trim_strip_input(usr, "Enter new law Zero. Leaving the field blank will cancel the edit.", "Edit Law", zeroth_law) + var/new_law = sanitize(input("Enter new law Zero. Leaving the field blank will cancel the edit.", "Edit Law", zeroth_law)) if(new_law && new_law != zeroth_law && can_still_topic()) zeroth_law = new_law return 1 if(href_list["change_ion_law"]) - var/new_law = trim_strip_input(usr, "Enter new ion law. Leaving the field blank will cancel the edit.", "Edit Law", ion_law) + var/new_law = sanitize(input("Enter new ion law. Leaving the field blank will cancel the edit.", "Edit Law", ion_law)) if(new_law && new_law != ion_law && can_still_topic()) ion_law = new_law return 1 if(href_list["change_inherent_law"]) - var/new_law = trim_strip_input(usr, "Enter new inherent law. Leaving the field blank will cancel the edit.", "Edit Law", inherent_law) + var/new_law = sanitize(input("Enter new inherent law. Leaving the field blank will cancel the edit.", "Edit Law", inherent_law)) if(new_law && new_law != inherent_law && can_still_topic()) inherent_law = new_law return 1 if(href_list["change_supplied_law"]) - var/new_law = trim_strip_input(usr, "Enter new supplied law. Leaving the field blank will cancel the edit.", "Edit Law", supplied_law) + var/new_law = sanitize(input("Enter new supplied law. Leaving the field blank will cancel the edit.", "Edit Law", supplied_law)) if(new_law && new_law != supplied_law && can_still_topic()) supplied_law = new_law return 1 @@ -110,7 +110,7 @@ if(is_malf(usr)) var/datum/ai_law/AL = locate(href_list["edit_law"]) in owner.laws.all_laws() if(AL) - var/new_law = trim_strip_input(usr, "Enter new law. Leaving the field blank will cancel the edit.", "Edit Law", AL.law) + var/new_law = sanitize(input(usr, "Enter new law. Leaving the field blank will cancel the edit.", "Edit Law", AL.law)) if(new_law && new_law != AL.law && is_malf(usr) && can_still_topic()) log_and_message_admins("has changed a law of [owner] from '[AL.law]' to '[new_law]'") AL.law = new_law diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index c004844c50..ddc211cc7c 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -35,7 +35,7 @@ user << "You put the [W] into \the [src]." update_icon() else if(istype(W, /obj/item/weapon/pen)) - var/n_name = sanitize(copytext(input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text, 1, MAX_NAME_LEN)) + var/n_name = sanitizeSafe(input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text, MAX_NAME_LEN) if((loc == usr && usr.stat == 0)) name = "folder[(n_name ? text("- '[n_name]'") : null)]" return diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 38f2f1610d..758cd78f20 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -86,7 +86,7 @@ if((CLUMSY in usr.mutations) && prob(50)) usr << "You cut yourself on the paper." return - var/n_name = sanitize(copytext(input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text, 1, MAX_NAME_LEN)) + var/n_name = sanitizeSafe(input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text, MAX_NAME_LEN) if((loc == usr && usr.stat == 0)) name = "[(n_name ? text("[n_name]") : initial(name))]" if(name != "paper") @@ -324,7 +324,7 @@ if(href_list["write"]) var/id = href_list["write"] //var/t = strip_html_simple(input(usr, "What text do you wish to add to " + (id=="end" ? "the end of the paper" : "field "+id) + "?", "[name]", null),8192) as message - var/t = strip_html_simple(input("Enter what you want to write:", "Write", null, null) as message, MAX_PAPER_MESSAGE_LEN) + var/t = sanitize(input("Enter what you want to write:", "Write", null, null) as message, MAX_PAPER_MESSAGE_LEN, extra = 0) var/obj/item/i = usr.get_active_hand() // Check to see if he still got that darn pen, also check if he's using a crayon or pen. var/iscrayon = 0 if(!istype(i, /obj/item/weapon/pen)) @@ -347,7 +347,7 @@ message_admins("PAPER: [usr] ([usr.ckey]) tried to use forbidden word in [src]: [bad].") return */ - t = html_encode(t) + //t = html_encode(t) t = replacetext(t, "\n", " ") t = parsepencode(t, i, usr, iscrayon) // Encode everything from pencode to html diff --git a/code/modules/paperwork/paper_bundle.dm b/code/modules/paperwork/paper_bundle.dm index 39ad7323ed..dfa5103ec2 100644 --- a/code/modules/paperwork/paper_bundle.dm +++ b/code/modules/paperwork/paper_bundle.dm @@ -192,7 +192,7 @@ set category = "Object" set src in usr - var/n_name = sanitize(copytext(input(usr, "What would you like to label the bundle?", "Bundle Labelling", null) as text, 1, MAX_NAME_LEN)) + var/n_name = sanitizeSafe(input(usr, "What would you like to label the bundle?", "Bundle Labelling", null) as text, MAX_NAME_LEN) if((loc == usr && usr.stat == 0)) name = "[(n_name ? text("[n_name]") : "paper")]" add_fingerprint(usr) diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index 18ff946cc8..3c3d07b36f 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -130,7 +130,7 @@ if(new_signature) signature = new_signature */ - signature = trim_strip_html_properly(input("Enter new signature. Leave blank for 'Anonymous'", "New Signature", signature)) + signature = sanitize(input("Enter new signature. Leave blank for 'Anonymous'", "New Signature", signature)) /obj/item/weapon/pen/proc/get_signature(var/mob/user) return (user && user.real_name) ? user.real_name : "Anonymous" diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 1b6756334c..24a321ac87 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -43,7 +43,7 @@ var/global/photo_count = 0 /obj/item/weapon/photo/attackby(obj/item/weapon/P as obj, mob/user as mob) if(istype(P, /obj/item/weapon/pen) || istype(P, /obj/item/toy/crayon)) - var/txt = sanitize(copytext(input(user, "What would you like to write on the back?", "Photo Writing", null) as text, 1, 128)) + var/txt = sanitize(input(user, "What would you like to write on the back?", "Photo Writing", null) as text, 128) if(loc == user && user.stat == 0) scribble = txt ..() @@ -70,7 +70,7 @@ var/global/photo_count = 0 set category = "Object" set src in usr - var/n_name = sanitize(copytext(input(usr, "What would you like to label the photo?", "Photo Labelling", null) as text, 1, MAX_NAME_LEN)) + var/n_name = sanitizeSafe(input(usr, "What would you like to label the photo?", "Photo Labelling", null) as text, MAX_NAME_LEN) //loc.loc check is for making possible renaming photos in clipboards if(( (loc == usr || (loc.loc && loc.loc == usr)) && usr.stat == 0)) name = "[(n_name ? text("[n_name]") : "photo")]" diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index d31ba64814..01f6a55044 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -31,9 +31,9 @@ if(!BB) user << "\blue There is no bullet in the casing to inscribe anything into." return - + var/tmp_label = "" - var/label_text = sanitize(copytext(input(user, "Inscribe some text into \the [initial(BB.name)]","Inscription",tmp_label), 1, MAX_NAME_LEN)) + var/label_text = sanitizeSafe(input(user, "Inscribe some text into \the [initial(BB.name)]","Inscription",tmp_label), MAX_NAME_LEN) if(length(label_text) > 20) user << "\red The inscription can be at most 20 characters long." else if(!label_text) @@ -54,7 +54,7 @@ //Gun loading types #define SINGLE_CASING 1 //The gun only accepts ammo_casings. ammo_magazines should never have this as their mag_type. -#define SPEEDLOADER 2 //Transfers casings from the mag to the gun when used. +#define SPEEDLOADER 2 //Transfers casings from the mag to the gun when used. #define MAGAZINE 4 //The magazine item itself goes inside the gun //An item that holds casings and can be used to put them inside guns @@ -71,15 +71,15 @@ w_class = 2 throw_speed = 4 throw_range = 10 - + var/list/stored_ammo = list() var/mag_type = SPEEDLOADER //ammo_magazines can only be used with compatible guns. This is not a bitflag, the load_method var on guns is. var/caliber = "357" var/max_ammo = 7 - + var/ammo_type = /obj/item/ammo_casing //ammo type that is initially loaded var/initial_ammo = null - + var/multiple_sprites = 0 //because BYOND doesn't support numbers as keys in associative lists var/list/icon_keys = list() //keys @@ -145,10 +145,10 @@ var/typestr = "[M.type]" if(!(typestr in magazine_icondata_keys) || !(typestr in magazine_icondata_states)) magazine_icondata_cache_add(M) - + M.icon_keys = magazine_icondata_keys[typestr] M.ammo_states = magazine_icondata_states[typestr] - + /proc/magazine_icondata_cache_add(var/obj/item/ammo_magazine/M) var/list/icon_keys = list() var/list/ammo_states = list() diff --git a/code/modules/projectiles/guns/projectile/pistol.dm b/code/modules/projectiles/guns/projectile/pistol.dm index f2155fa669..adbf30922d 100644 --- a/code/modules/projectiles/guns/projectile/pistol.dm +++ b/code/modules/projectiles/guns/projectile/pistol.dm @@ -22,7 +22,7 @@ M << "You don't feel cool enough to name this gun, chump." return 0 - var/input = stripped_input(usr,"What do you want to name the gun?", ,"", MAX_NAME_LEN) + var/input = sanitizeSafe(input("What do you want to name the gun?", ,""), MAX_NAME_LEN) if(src && input && !M.stat && in_range(M,src)) name = input diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index 9bef0c40d3..fb5895aad9 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -34,7 +34,7 @@ M << "You don't feel cool enough to name this gun, chump." return 0 - var/input = stripped_input(usr,"What do you want to name the gun?", ,"", MAX_NAME_LEN) + var/input = sanitizeSafe(input("What do you want to name the gun?", ,""), MAX_NAME_LEN) if(src && input && !M.stat && in_range(M,src)) name = input diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index 6885f82d5d..bef45fbb16 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -178,7 +178,7 @@ var/amount_per_pill = reagents.total_volume/count if (amount_per_pill > 60) amount_per_pill = 60 - var/name = reject_bad_text(input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill] units)")) + var/name = sanitizeSafe(input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill] units)"), MAX_NAME_LEN) if(reagents.total_volume/count < 1) //Sanity checking. return @@ -197,7 +197,7 @@ else if (href_list["createbottle"]) if(!condi) - var/name = reject_bad_text(input(usr,"Name:","Name your bottle!",reagents.get_master_reagent_name())) + var/name = sanitizeSafe(input(usr,"Name:","Name your bottle!",reagents.get_master_reagent_name()), MAX_NAME_LEN) var/obj/item/weapon/reagent_containers/glass/bottle/P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc) if(!name) name = reagents.get_master_reagent_name() P.name = "[name] bottle" @@ -406,7 +406,7 @@ if(type in diseases) // Make sure this is a disease D = new type(0, null) var/list/data = list("viruses"=list(D)) - var/name = sanitize(input(usr,"Name:","Name the culture",D.name)) + var/name = sanitizeSafe(input(usr,"Name:","Name the culture",D.name)) if(!name || name == " ") name = D.name B.name = "[name] culture bottle" B.desc = "A small bottle. Contains [D.agent] culture in synthblood medium." @@ -435,7 +435,7 @@ src.updateUsrDialog() return else if(href_list["name_disease"]) - var/new_name = stripped_input(usr, "Name the Disease", "New Name", "", MAX_NAME_LEN) + var/new_name = sanitizeSafe(input(usr, "Name the Disease", "New Name", ""), MAX_NAME_LEN) if(stat & (NOPOWER|BROKEN)) return if(usr.stat || usr.restrained()) return if(!in_range(src, usr)) return diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 7fb254080b..68db3b98c8 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -2781,7 +2781,7 @@ if( src.open ) return - var/t = input("Enter what you want to add to the tag:", "Write", null, null) as text + var/t = sanitize(input("Enter what you want to add to the tag:", "Write", null, null) as text, 30) var/obj/item/pizzabox/boxtotagto = src if( boxes.len > 0 ) diff --git a/code/modules/reagents/reagent_containers/glass.dm b/code/modules/reagents/reagent_containers/glass.dm index c056d4479c..12b56021d4 100644 --- a/code/modules/reagents/reagent_containers/glass.dm +++ b/code/modules/reagents/reagent_containers/glass.dm @@ -138,7 +138,7 @@ attackby(obj/item/weapon/W as obj, mob/user as mob) if(istype(W, /obj/item/weapon/pen) || istype(W, /obj/item/device/flashlight/pen)) - var/tmp_label = sanitize(copytext(input(user, "Enter a label for [src.name]","Label",src.label_text), 1, MAX_NAME_LEN)) + var/tmp_label = sanitizeSafe(input(user, "Enter a label for [src.name]","Label",src.label_text), MAX_NAME_LEN) if(length(tmp_label) > 10) user << "\red The label can be at most 10 characters long." else diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 5b375ed8f7..7a7622dd77 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -43,7 +43,7 @@ else if(istype(W, /obj/item/weapon/pen)) switch(alert("What would you like to alter?",,"Title","Description", "Cancel")) if("Title") - var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_NAME_LEN))) + var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN) if(!str || !length(str)) usr << " Invalid text." return @@ -57,7 +57,7 @@ else nameset = 1 if("Description") - var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_MESSAGE_LEN))) + var/str = sanitize(input(usr,"Label text?","Set label","")) if(!str || !length(str)) usr << "\red Invalid text." return @@ -150,7 +150,7 @@ else if(istype(W, /obj/item/weapon/pen)) switch(alert("What would you like to alter?",,"Title","Description", "Cancel")) if("Title") - var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_NAME_LEN))) + var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN) if(!str || !length(str)) usr << " Invalid text." return @@ -165,7 +165,7 @@ nameset = 1 if("Description") - var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_MESSAGE_LEN))) + var/str = sanitize(input(usr,"Label text?","Set label","")) if(!str || !length(str)) usr << "\red Invalid text." return diff --git a/code/modules/research/xenoarchaeology/chemistry.dm b/code/modules/research/xenoarchaeology/chemistry.dm index f5b718dcf0..eae7b0afc0 100644 --- a/code/modules/research/xenoarchaeology/chemistry.dm +++ b/code/modules/research/xenoarchaeology/chemistry.dm @@ -84,7 +84,7 @@ datum obj/item/weapon/reagent_containers/glass/solution_tray/attackby(obj/item/weapon/W as obj, mob/living/user as mob) if(istype(W, /obj/item/weapon/pen)) - var/new_label = input("What should the new label be?","Label solution tray") + var/new_label = sanitizeSafe(input("What should the new label be?","Label solution tray"), MAX_NAME_LEN) if(new_label) name = "solution tray ([new_label])" user << "\blue You write on the label of the solution tray." diff --git a/code/modules/research/xenoarchaeology/finds/finds_fossils.dm b/code/modules/research/xenoarchaeology/finds/finds_fossils.dm index 57d510015f..80dbf549c0 100644 --- a/code/modules/research/xenoarchaeology/finds/finds_fossils.dm +++ b/code/modules/research/xenoarchaeology/finds/finds_fossils.dm @@ -79,7 +79,7 @@ else ..() else if(istype(W,/obj/item/weapon/pen)) - plaque_contents = input("What would you like to write on the plaque:","Skeleton plaque","") + plaque_contents = sanitize(input("What would you like to write on the plaque:","Skeleton plaque","")) user.visible_message("[user] writes something on the base of [src].","You relabel the plaque on the base of \icon[src] [src].") if(src.contents.Find(/obj/item/weapon/fossil/skull/horned)) src.desc = "A creature made of [src.contents.len-1] assorted bones and a horned skull. The plaque reads \'[plaque_contents]\'." |