diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm
index b90f7502e65..04d63e0e862 100644
--- a/code/__HELPERS/text.dm
+++ b/code/__HELPERS/text.dm
@@ -28,6 +28,11 @@
/*
* Text sanitization
*/
+// Can be used almost the same way as normal input for text
+/proc/clean_input(Message, Title, Default, mob/user=usr)
+ var/txt = input(user, Message, Title, Default) as text | null
+ if(txt)
+ return html_encode(txt)
//Simply removes < and > and limits the length of the message
/proc/strip_html_simple(var/t,var/limit=MAX_MESSAGE_LEN)
@@ -125,8 +130,10 @@
//Filters out undesirable characters from names
/proc/reject_bad_name(var/t_in, var/allow_numbers=0, var/max_length=MAX_NAME_LEN)
+ // Decode so that names with characters like < are still rejected. Will be encoded again at the end
+ t_in = html_decode(t_in)
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
+ return //Rejects the input if it is null or if it is longer than the max length allowed
var/number_of_alphanumeric = 0
var/last_char_group = 0
@@ -185,7 +192,7 @@
for(var/bad_name in list("space","floor","wall","r-wall","monkey","unknown","inactive ai","plating")) //prevents these common metagamey names
if(cmptext(t_out,bad_name)) return //(not case sensitive)
- return t_out
+ return html_encode(t_out)
//checks text for html tags
//if tag is not in whitelist (var/list/paper_tag_whitelist in global.dm)
diff --git a/code/controllers/subsystem/events.dm b/code/controllers/subsystem/events.dm
index 95553ab0d7e..2f415efa38d 100644
--- a/code/controllers/subsystem/events.dm
+++ b/code/controllers/subsystem/events.dm
@@ -249,7 +249,7 @@ SUBSYSTEM_DEF(events)
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 = clean_input("Enter event name.", "Set Name")
if(name)
var/datum/event_meta/EM = locate(href_list["set_name"])
EM.name = name
diff --git a/code/game/gamemodes/blob/powers.dm b/code/game/gamemodes/blob/powers.dm
index 2743277edb7..e7751ffcd8a 100644
--- a/code/game/gamemodes/blob/powers.dm
+++ b/code/game/gamemodes/blob/powers.dm
@@ -388,7 +388,7 @@
set name = "Blob Broadcast"
set desc = "Speak with your blob spores and blobbernauts as your mouthpieces. This action is free."
- var/speak_text = input(usr, "What would you like to say with your minions?", "Blob Broadcast", null) as text
+ var/speak_text = clean_input("What would you like to say with your minions?", "Blob Broadcast", null)
if(!speak_text)
return
diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm
index d262b523808..1d0b8dde152 100644
--- a/code/game/machinery/atmo_control.dm
+++ b/code/game/machinery/atmo_control.dm
@@ -357,7 +357,7 @@
return O:id_tag in sensors
/obj/machinery/computer/general_air_control/linkWith(mob/user, obj/O, link/context)
- sensors[O:id_tag] = reject_bad_name(input(user, "Choose a sensor label:", "Sensor Label") as text|null, allow_numbers=1)
+ sensors[O:id_tag] = reject_bad_name(clean_input(user, "Choose a sensor label:", "Sensor Label"), allow_numbers=1)
return 1
/obj/machinery/computer/general_air_control/large_tank_control
diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm
index d064dbda743..be27b0600cf 100644
--- a/code/game/machinery/computer/communications.dm
+++ b/code/game/machinery/computer/communications.dm
@@ -156,7 +156,7 @@
message_cooldown = 0
if("callshuttle")
- var/input = input(usr, "Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","") as text|null
+ var/input = clean_input("Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","")
if(!input || ..() || !is_authenticated(usr))
SSnanoui.update_uis(src)
return
@@ -217,11 +217,11 @@
setMenuState(usr,COMM_SCREEN_STAT)
if("setmsg1")
- stat_msg1 = input("Line 1", "Enter Message Text", stat_msg1) as text|null
+ stat_msg1 = clean_input("Line 1", "Enter Message Text", stat_msg1)
setMenuState(usr,COMM_SCREEN_STAT)
if("setmsg2")
- stat_msg2 = input("Line 2", "Enter Message Text", stat_msg2) as text|null
+ stat_msg2 = clean_input("Line 2", "Enter Message Text", stat_msg2)
setMenuState(usr,COMM_SCREEN_STAT)
if("nukerequest")
diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm
index fb09b40f440..dbe766a2c44 100644
--- a/code/game/machinery/computer/medical.dm
+++ b/code/game/machinery/computer/medical.dm
@@ -466,7 +466,7 @@
active2.fields["comments"] -= active2.fields["comments"][index]
if(href_list["search"])
- var/t1 = input("Search String: (Name, DNA, or ID)", "Med. records", null, null) as text
+ var/t1 = clean_input("Search String: (Name, DNA, or ID)", "Med. records", null, null)
if(!t1 || ..())
return 1
active1 = null
diff --git a/code/game/machinery/computer/message.dm b/code/game/machinery/computer/message.dm
index 87d35c2d7b4..d6e000d660d 100644
--- a/code/game/machinery/computer/message.dm
+++ b/code/game/machinery/computer/message.dm
@@ -281,7 +281,7 @@
auth = 0
screen = 0
else
- var/dkey = trim(input(usr, "Please enter the decryption key.") as text|null)
+ var/dkey = trim(clean_input("Please enter the decryption key."))
if(dkey && dkey != "")
if(src.linkedServer.decryptkey == dkey)
auth = 1
@@ -332,7 +332,7 @@
message = noserver
else
if(auth)
- var/dkey = trim(input(usr, "Please enter the decryption key.") as text|null)
+ var/dkey = trim(clean_input("Please enter the decryption key."))
if(dkey && dkey != "")
if(src.linkedServer.decryptkey == dkey)
var/newkey = trim(input(usr,"Please enter the new key (3 - 16 characters max):"))
@@ -395,7 +395,7 @@
//Select Your Name
if("Sender")
- customsender = input(usr, "Please enter the sender's name.") as text|null
+ customsender = clean_input("Please enter the sender's name.")
//Select Receiver
if("Recepient")
@@ -414,11 +414,11 @@
//Enter custom job
if("RecJob")
- customjob = input(usr, "Please enter the sender's job.") as text|null
+ customjob = clean_input("Please enter the sender's job.")
//Enter message
if("Message")
- custommessage = input(usr, "Please enter your message.") as text|null
+ custommessage = clean_input("Please enter your message.")
custommessage = sanitize(copytext(custommessage, 1, MAX_MESSAGE_LEN))
//Send message
diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm
index c0c8c2d349e..bed10bb0923 100644
--- a/code/game/machinery/computer/security.dm
+++ b/code/game/machinery/computer/security.dm
@@ -398,7 +398,7 @@
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 = reject_bad_name(clean_input("Please input name:", "Secure. records", active1.fields["name"], null))
if(!t1 || !length(trim(t1)) || ..() || active1 != a1)
return 1
active1.fields["name"] = t1
diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm
index ac10eb6e22d..5647ae73766 100644
--- a/code/game/machinery/computer/skills.dm
+++ b/code/game/machinery/computer/skills.dm
@@ -245,7 +245,7 @@
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 = reject_bad_name(clean_input("Please input name:", "Secure. records", active1.fields["name"], null))
if(!t1 || !length(trim(t1)) || incapable || active1 != a1)
return 1
active1.fields["name"] = t1
diff --git a/code/game/machinery/telecomms/ntsl2.dm b/code/game/machinery/telecomms/ntsl2.dm
index 04f85750516..a5c4f3f1464 100644
--- a/code/game/machinery/telecomms/ntsl2.dm
+++ b/code/game/machinery/telecomms/ntsl2.dm
@@ -409,10 +409,10 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new())
// if(href_list["table"] && href_list["table"] in tables)
// if(requires_unlock[href_list["table"]] && !source.unlocked)
// return
- // var/new_key = input(user, "Provide a key for the new row.", "New Row") as text|null
+ // var/new_key = clean_input(user, "Provide a key for the new row.", "New Row")
// if(!new_key)
// return
- // var/new_value = input(user, "Provide a new value for the key [new_key]", "New Row") as text|null
+ // var/new_value = clean_input(user, "Provide a new value for the key [new_key]", "New Row")
// if(new_value == null)
// return
// if(word_blacklist.Find(new_value)) //uh oh, they tried to be naughty
@@ -439,7 +439,7 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new())
if(href_list["array"] && href_list["array"] in arrays)
if(requires_unlock[href_list["array"]] && !source.unlocked)
return
- var/new_value = input(user, "Provide a value for the new index.", "New Index") as text|null
+ var/new_value = clean_input(user, "Provide a value for the new index.", "New Index")
if(new_value == null)
return
var/list/array = vars[href_list["array"]]
diff --git a/code/game/objects/items/devices/voice.dm b/code/game/objects/items/devices/voice.dm
index 339271cdcca..38bcd16f01e 100644
--- a/code/game/objects/items/devices/voice.dm
+++ b/code/game/objects/items/devices/voice.dm
@@ -34,7 +34,7 @@
A.UpdateButtonIcon()
/obj/item/voice_changer/proc/set_voice(mob/user)
- var/chosen_voice = input(user, "What voice would you like to mimic? Leave this empty to use the voice on your ID card.", "Set Voice Changer", voice) as text
+ var/chosen_voice = clean_input("What voice would you like to mimic? Leave this empty to use the voice on your ID card.", "Set Voice Changer", voice, user)
if(!chosen_voice)
voice = null
to_chat(user, "You are now mimicking the voice on your ID card.")
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index 2701a213976..3b282fa6893 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -475,7 +475,7 @@ var/list/admin_verbs_ticket = list(
if(holder.fakekey)
holder.fakekey = null
else
- var/new_key = ckeyEx(input("Enter your desired display name.", "Fake Key", key) as text|null)
+ var/new_key = ckeyEx(clean_input("Enter your desired display name.", "Fake Key", key))
if(!new_key) return
if(length(new_key) >= 26)
new_key = copytext(new_key, 1, 26)
@@ -497,7 +497,7 @@ var/list/admin_verbs_ticket = list(
holder.fakekey = null
holder.big_brother = 0
else
- var/new_key = ckeyEx(input("Enter your desired display name. Unlike normal stealth mode, this will not appear in Who at all, except for other heads.", "Fake Key", key) as text|null)
+ var/new_key = ckeyEx(clean_input("Enter your desired display name. Unlike normal stealth mode, this will not appear in Who at all, except for other heads.", "Fake Key", key))
if(!new_key)
return
if(length(new_key) >= 26)
@@ -638,7 +638,7 @@ var/list/admin_verbs_ticket = list(
return
if(O)
- var/message = input("What do you want the message to be?", "Make Sound") as text|null
+ var/message = clean_input("What do you want the message to be?", "Make Sound")
if(!message)
return
for(var/mob/V in hearers(O))
diff --git a/code/modules/admin/sql_notes.dm b/code/modules/admin/sql_notes.dm
index 9024959b943..18112f584c2 100644
--- a/code/modules/admin/sql_notes.dm
+++ b/code/modules/admin/sql_notes.dm
@@ -5,7 +5,7 @@
to_chat(usr, "Failed to establish database connection.")
return
if(!target_ckey)
- var/new_ckey = ckey(input(usr,"Who would you like to add a note for?","Enter a ckey",null) as text|null)
+ var/new_ckey = ckey(clean_input("Who would you like to add a note for?","Enter a ckey",null))
if(!new_ckey)
return
new_ckey = ckey(new_ckey)
diff --git a/code/modules/admin/stickyban.dm b/code/modules/admin/stickyban.dm
index bddebcff602..61759f2e36d 100644
--- a/code/modules/admin/stickyban.dm
+++ b/code/modules/admin/stickyban.dm
@@ -16,7 +16,7 @@
if(data["ckey"])
ckey = ckey(data["ckey"])
else
- ckey = input(usr,"Ckey","Ckey","") as text|null
+ ckey = clean_input("Ckey","Ckey","")
if(!ckey)
return
ckey = ckey(ckey)
@@ -26,7 +26,7 @@
if(data["reason"])
ban["message"] = data["reason"]
else
- var/reason = input(usr,"Reason","Reason","Ban Evasion") as text|null
+ var/reason = clean_input("Reason","Reason","Ban Evasion")
if(!reason)
return
ban["message"] = "[reason]"
@@ -112,7 +112,7 @@
to_chat(usr, "Error: No sticky ban for [ckey] found!")
return
var/oldreason = ban["message"]
- var/reason = input(usr,"Reason","Reason","[ban["message"]]") as text|null
+ var/reason = clean_input("Reason","Reason","[ban["message"]]")
if(!reason || reason == oldreason)
return
//we have to do this again incase something changed while we waited for input
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index 85d835651e3..ebe2219d90b 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -189,7 +189,7 @@
var/task = href_list["editrights"]
if(task == "add")
- var/new_ckey = ckey(input(usr,"New admin's ckey","Admin ckey", null) as text|null)
+ var/new_ckey = ckey(clean_input("New admin's ckey","Admin ckey", null))
if(!new_ckey) return
if(new_ckey in admin_datums)
to_chat(usr, "Error: Topic 'editrights': [new_ckey] is already an admin")
@@ -1700,7 +1700,7 @@
var/eviltype = input(src.owner, "Which type of evil fax do you wish to send [H]?","Its good to be baaaad...", "") as null|anything in etypes
if(!(eviltype in etypes))
return
- var/customname = input(src.owner, "Pick a title for the evil fax.", "Fax Title") as text|null
+ var/customname = clean_input("Pick a title for the evil fax.", "Fax Title", , owner)
if(!customname)
customname = "paper"
var/obj/item/paper/evilfax/P = new /obj/item/paper/evilfax(null)
@@ -2183,7 +2183,7 @@
return
input = P.parsepencode(input) // Encode everything from pencode to html
- var/customname = input(src.owner, "Pick a title for the fax.", "Fax Title") as text|null
+ var/customname = clean_input("Pick a title for the fax.", "Fax Title", , owner)
if(!customname)
customname = "paper"
@@ -2216,14 +2216,14 @@
if("clown")
stampvalue = "clown"
else if(stamptype == "text")
- stampvalue = input(src.owner, "What should the stamp say?", "Stamp Text") as text|null
+ stampvalue = clean_input("What should the stamp say?", "Stamp Text", , owner)
else if(stamptype == "none")
stamptype = ""
else
qdel(P)
return
- sendername = input(src.owner, "What organization does the fax come from? This determines the prefix of the paper (i.e. Central Command- Title). This is optional.", "Organization") as text|null
+ sendername = clean_input("What organization does the fax come from? This determines the prefix of the paper (i.e. Central Command- Title). This is optional.", "Organization", , owner)
if(sender)
notify = alert(src.owner, "Would you like to inform the original sender that a fax has arrived?","Notify Sender","Yes","No")
@@ -3283,7 +3283,7 @@
return
var/datum/station_goal/G = new picked()
if(picked == /datum/station_goal)
- var/newname = input("Enter goal name:") as text|null
+ var/newname = clean_input("Enter goal name:")
if(!newname)
return
G.name = newname
diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm
index 8c5d76e62e1..4aceade3526 100644
--- a/code/modules/admin/verbs/adminhelp.dm
+++ b/code/modules/admin/verbs/adminhelp.dm
@@ -18,7 +18,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
var/list/type = list("Mentorhelp","Adminhelp")
var/selected_type = input("Pick a category.", "Admin Help", null, null) as null|anything in type
if(selected_type)
- msg = input("Please enter your message.", "Admin Help", null, null) as text|null
+ msg = clean_input("Please enter your message.", "Admin Help", null)
//clean the input msg
if(!msg)
diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm
index 83531c9b0b9..0b7632595e8 100644
--- a/code/modules/admin/verbs/adminpm.dm
+++ b/code/modules/admin/verbs/adminpm.dm
@@ -89,7 +89,7 @@
//get message text, limit it's length.and clean/escape html
if(!msg)
set_typing(C, TRUE)
- msg = input(src,"Message:", "Private message to [holder ? key_name(C, FALSE) : key_name_hidden(C, FALSE)]") as text|null
+ msg = clean_input("Message:", "Private message to [holder ? key_name(C, FALSE) : key_name_hidden(C, FALSE)]", , src)
set_typing(C, FALSE)
if(!msg)
@@ -109,6 +109,8 @@
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
if(!msg)
return
+ else
+ msg = pencode_to_html(msg)
var/recieve_span = "playerreply"
var/send_pm_type = " "
@@ -147,7 +149,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] [type] from-[sendername]", "") as text|null //show message and await a reply
+ var/reply = clean_input(msg,"[recieve_pm_type] [type] from-[sendername]", "", C) //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
@@ -216,7 +218,7 @@
to_chat(src, "Error: Private-Message: You are unable to use PM-s (muted).")
return
- var/msg = input(src,"Message:", "Private message to admins on IRC / 400 character limit") as text|null
+ var/msg = clean_input("Message:", "Private message to admins on IRC / 400 character limit", , src) as text|null
if(!msg)
return
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 6a419ebb29a..008eaa4a910 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -68,7 +68,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
target = null
targetselected = 0
- var/procname = input("Proc path, eg: /proc/fake_blood","Path:", null) as text|null
+ var/procname = clean_input("Proc path, eg: /proc/fake_blood","Path:", null)
if(!procname) return
if(targetselected && !hascall(target,procname))
@@ -102,7 +102,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(!check_rights(R_PROCCALL))
return
- var/procname = input("Proc name, eg: fake_blood","Proc:", null) as text|null
+ var/procname = clean_input("Proc name, eg: fake_blood","Proc:", null)
if(!procname)
return
@@ -149,7 +149,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return null
if("text")
- lst += input("Enter new text:","Text",null) as text
+ lst += clean_input("Enter new text:","Text",null)
if("num")
lst += input("Enter new number:","Num",0) as num
@@ -271,7 +271,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return 0
var/obj/item/paicard/card = new(T)
var/mob/living/silicon/pai/pai = new(card)
- var/raw_name = input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text
+ var/raw_name = clean_input("Enter your pAI name:", "pAI Name", "Personal AI", choice)
var/new_name = reject_bad_name(raw_name, 1)
if(new_name)
pai.name = new_name
diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm
index 93389acbdd8..23d171e69a0 100644
--- a/code/modules/admin/verbs/diagnostics.dm
+++ b/code/modules/admin/verbs/diagnostics.dm
@@ -145,7 +145,7 @@
if(!check_rights(R_DEBUG))
return
- var/filter = input("Contains what?","Filter") as text|null
+ var/filter = clean_input("Contains what?","Filter")
if(!filter)
return
@@ -166,7 +166,7 @@
if(!check_rights(R_DEBUG))
return
- var/refstring = input("Which reference?","Ref") as text|null
+ var/refstring = clean_input("Which reference?","Ref")
if(!refstring)
return
diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm
index a87308bb9b1..80a171494ea 100644
--- a/code/modules/admin/verbs/mapping.dm
+++ b/code/modules/admin/verbs/mapping.dm
@@ -132,13 +132,13 @@ var/intercom_range_display_status = 0
if(!check_rights(R_DEBUG))
return
- var/level = input("Which z-level?","Level?") as text
+ var/level = clean_input("Which z-level?","Level?")
if(!level) return
var/num_level = text2num(level)
if(!num_level) return
if(!isnum(num_level)) return
- var/type_text = input("Which type path?","Path?") as text
+ var/type_text = clean_input("Which type path?","Path?")
if(!type_text) return
var/type_path = text2path(type_text)
if(!type_path) return
@@ -170,7 +170,7 @@ var/intercom_range_display_status = 0
if(!check_rights(R_DEBUG))
return
- var/type_text = input("Which type path?","") as text
+ var/type_text = clean_input("Which type path?","")
if(!type_text) return
var/type_path = text2path(type_text)
if(!type_path) return
diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm
index ec731458109..ae44648b5d5 100644
--- a/code/modules/admin/verbs/randomverbs.dm
+++ b/code/modules/admin/verbs/randomverbs.dm
@@ -54,7 +54,7 @@
if(!check_rights(R_SERVER|R_EVENT))
return
- var/msg = input("Message:", text("Subtle PM to [M.key]")) as text
+ var/msg = clean_input("Message:", text("Subtle PM to [M.key]"))
if(!msg)
return
@@ -109,10 +109,11 @@
if(!check_rights(R_SERVER|R_EVENT))
return
- var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text
+ var/msg = clean_input("Message:", text("Enter the text you wish to appear to everyone:"))
if(!msg)
return
+ msg = pencode_to_html(msg)
to_chat(world, "[msg]")
log_admin("GlobalNarrate: [key_name(usr)] : [msg]")
message_admins("GlobalNarrate: [key_name_admin(usr)]: [msg]
", 1)
@@ -131,10 +132,11 @@
if(!M)
return
- var/msg = input("Message:", text("Enter the text you wish to appear to your target:")) as text
+ var/msg = clean_input("Message:", text("Enter the text you wish to appear to your target:"))
if( !msg )
return
+ msg = pencode_to_html(msg)
to_chat(M, msg)
log_admin("DirectNarrate: [key_name(usr)] to ([key_name(M)]): [msg]")
@@ -169,7 +171,7 @@
return
message_admins("[key_name_admin(src)] has started answering [key_name_admin(H)]'s [sender] request.")
- var/input = input("Please enter a message to reply to [key_name(H)] via their headset.", "Outgoing message from [sender]", "") as text|null
+ var/input = clean_input("Please enter a message to reply to [key_name(H)] via their headset.", "Outgoing message from [sender]", "")
if(!input)
message_admins("[key_name_admin(src)] decided not to answer [key_name_admin(H)]'s [sender] request.")
return
@@ -550,7 +552,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(!check_rights(R_EVENT))
return
- var/input = input(usr, "Please enter anything you want the AI to do. Anything. Serious.", "What?", "") as text|null
+ var/input = clean_input("Please enter anything you want the AI to do. Anything. Serious.", "What?", "")
if(!input)
return
@@ -603,14 +605,15 @@ Traitors and the like can also be revived with the previous role mostly intact.
var/type = input(usr, "Pick a type of report to send", "Report Type", "") as anything in MsgType
if(type == "Custom")
- type = input(usr, "What would you like the report type to be?", "Report Type", "Encrypted Transmission") as text|null
+ type = clean_input("What would you like the report type to be?", "Report Type", "Encrypted Transmission")
- var/customname = input(usr, "Pick a title for the report.", "Title", MsgType[type]) as text|null
+ var/customname = clean_input("Pick a title for the report.", "Title", MsgType[type])
if(!customname)
return
var/input = input(usr, "Please enter anything you want. Anything. Serious.", "What's the message?") as message|null
if(!input)
return
+ input = pencode_to_html(html_encode(input))
switch(alert("Should this be announced to the general population?",,"Yes","No", "Cancel"))
if("Yes")
diff --git a/code/modules/admin/watchlist.dm b/code/modules/admin/watchlist.dm
index 1ac267f1037..040bc08112b 100644
--- a/code/modules/admin/watchlist.dm
+++ b/code/modules/admin/watchlist.dm
@@ -2,7 +2,7 @@
if(!check_rights(R_ADMIN))
return
if(!target_ckey)
- var/new_ckey = ckey(input(usr,"Who would you like to add to the watchlist?","Enter a ckey",null) as text)
+ var/new_ckey = ckey(clean_input("Who would you like to add to the watchlist?","Enter a ckey",null))
if(!new_ckey)
return
new_ckey = sanitizeSQL(new_ckey)
diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm
index 3c8b293ea28..97f9ddc6169 100644
--- a/code/modules/client/preference/preferences.dm
+++ b/code/modules/client/preference/preferences.dm
@@ -1263,7 +1263,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
if("input")
switch(href_list["preference"])
if("name")
- var/raw_name = input(user, "Choose your character's name:", "Character Preference") as text|null
+ var/raw_name = clean_input("Choose your character's name:", "Character Preference", , user)
if(!isnull(raw_name)) // Check to ensure that the user entered text (rather than cancel.)
var/new_name = reject_bad_name(raw_name, 1)
if(new_name)
diff --git a/code/modules/economy/EFTPOS.dm b/code/modules/economy/EFTPOS.dm
index f9bb22fcda4..f3df3027780 100644
--- a/code/modules/economy/EFTPOS.dm
+++ b/code/modules/economy/EFTPOS.dm
@@ -116,7 +116,7 @@
else
to_chat(usr, "[bicon(src)]Unable to connect to accounts database.")
if("trans_purpose")
- var/purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose", transaction_purpose) as text|null
+ var/purpose = clean_input("Enter reason for EFTPOS transaction", "Transaction purpose", transaction_purpose)
if(purpose)
transaction_purpose = purpose
if("trans_value")
diff --git a/code/modules/food_and_drinks/food/foods/pizza.dm b/code/modules/food_and_drinks/food/foods/pizza.dm
index aabd47194ce..cbe7342b74b 100644
--- a/code/modules/food_and_drinks/food/foods/pizza.dm
+++ b/code/modules/food_and_drinks/food/foods/pizza.dm
@@ -224,7 +224,7 @@
if(istype(I, /obj/item/pen/))
if(open)
return
- var/t = input("Enter what you want to add to the tag:", "Write", null, null) as text
+ var/t = clean_input("Enter what you want to add to the tag:", "Write", null)
var/obj/item/pizzabox/boxtotagto = src
if(boxes.len > 0)
boxtotagto = boxes[boxes.len]
diff --git a/code/modules/mining/abandonedcrates.dm b/code/modules/mining/abandonedcrates.dm
index a413c328870..e96fd0e867b 100644
--- a/code/modules/mining/abandonedcrates.dm
+++ b/code/modules/mining/abandonedcrates.dm
@@ -151,7 +151,7 @@
/obj/structure/closet/crate/secure/loot/attack_hand(mob/user)
if(locked)
to_chat(user, "The crate is locked with a Deca-code lock.")
- var/input = input(usr, "Enter [codelen] digits.", "Deca-Code Lock", "") as text
+ var/input = clean_input("Enter [codelen] digits.", "Deca-Code Lock", "")
if(in_range(src, user))
if(input == code)
to_chat(user, "The crate unlocks!")
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 17fd47d560b..023c03cd00a 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -498,7 +498,7 @@ var/list/ai_verbs_default = list(
if(check_unable(AI_CHECK_WIRELESS))
return
- var/input = input(usr, "Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","") as text|null
+ var/input = clean_input("Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","")
if(!input || stat)
return
@@ -1074,7 +1074,7 @@ var/list/ai_verbs_default = list(
set desc = "Change the message that's transmitted when a new crew member arrives on station."
set category = "AI Commands"
- var/newmsg = input("What would you like the arrival message to be? List of options: $name, $rank, $species, $gender, $age", "Change Arrival Message", arrivalmsg) as text
+ var/newmsg = clean_input("What would you like the arrival message to be? List of options: $name, $rank, $species, $gender, $age", "Change Arrival Message", arrivalmsg)
if(newmsg != arrivalmsg)
arrivalmsg = newmsg
to_chat(usr, "The arrival message has been successfully changed.")
diff --git a/code/modules/mob/living/silicon/ai/say.dm b/code/modules/mob/living/silicon/ai/say.dm
index e44ba0741be..36f248cd2c2 100644
--- a/code/modules/mob/living/silicon/ai/say.dm
+++ b/code/modules/mob/living/silicon/ai/say.dm
@@ -99,7 +99,7 @@ var/const/VOX_PATH = "sound/vox_fem/"
to_chat(src, "Please wait [round((announcing_vox - world.time) / 10)] seconds.")
return
- var/message = input(src, "WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", last_announcement) as text|null
+ var/message = clean_input("WARNING: Misuse of this verb can result in you being job banned. More help is available in 'Announcement Help'", "Announcement", last_announcement, src)
last_announcement = message
diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm
index efda8f38863..279610f0925 100644
--- a/code/modules/mob/mob_helpers.dm
+++ b/code/modules/mob/mob_helpers.dm
@@ -567,9 +567,9 @@ var/list/intents = list(INTENT_HELP,INTENT_DISARM,INTENT_GRAB,INTENT_HARM)
for(var/i=1,i<=3,i++) //we get 3 attempts to pick a suitable name.
if(force)
- newname = input(src, "Pick a new name.", "Name Change", oldname) as text
+ newname = clean_input("Pick a new name.", "Name Change", oldname, src)
else
- newname = input(src, "You are a [role]. Would you like to change your name to something else? (You have 3 minutes to select a new name.)", "Name Change", oldname) as text
+ newname = input("You are a [role]. Would you like to change your name to something else? (You have 3 minutes to select a new name.)", "Name Change", oldname, src)
if(((world.time - time_passed) > 1800) && !force)
alert(src, "Unfortunately, more than 3 minutes have passed for selecting your name. If you are a robot, use the Namepick verb; otherwise, adminhelp.", "Name Change")
return //took too long
diff --git a/code/modules/mob/mob_transformation_simple.dm b/code/modules/mob/mob_transformation_simple.dm
index a94be6a54c1..c3ec68c9793 100644
--- a/code/modules/mob/mob_transformation_simple.dm
+++ b/code/modules/mob/mob_transformation_simple.dm
@@ -9,7 +9,7 @@
return
if(!new_type)
- new_type = input("Mob type path:", "Mob type") as text|null
+ new_type = clean_input("Mob type path:", "Mob type")
if(istext(new_type))
new_type = text2path(new_type)
diff --git a/code/modules/modular_computers/file_system/programs/command/comms.dm b/code/modules/modular_computers/file_system/programs/command/comms.dm
index 637e4379e0a..dfce733cc7a 100644
--- a/code/modules/modular_computers/file_system/programs/command/comms.dm
+++ b/code/modules/modular_computers/file_system/programs/command/comms.dm
@@ -245,7 +245,7 @@
message_cooldown = 0
if("callshuttle")
- var/input = input(usr, "Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","") as text|null
+ var/input = clean_input("Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","")
if(!input || ..() || !is_authenticated(usr))
SSnanoui.update_uis(src)
return 1
@@ -306,11 +306,11 @@
setMenuState(usr, COMM_SCREEN_STAT)
if("setmsg1")
- stat_msg1 = input("Line 1", "Enter Message Text", stat_msg1) as text|null
+ stat_msg1 = clean_input("Line 1", "Enter Message Text", stat_msg1)
setMenuState(usr, COMM_SCREEN_STAT)
if("setmsg2")
- stat_msg2 = input("Line 2", "Enter Message Text", stat_msg2) as text|null
+ stat_msg2 = clean_input("Line 2", "Enter Message Text", stat_msg2)
setMenuState(usr, COMM_SCREEN_STAT)
if("nukerequest")
diff --git a/code/modules/ninja/suit/SpiderOS.dm b/code/modules/ninja/suit/SpiderOS.dm
index cb91167e202..d9827c5cf32 100644
--- a/code/modules/ninja/suit/SpiderOS.dm
+++ b/code/modules/ninja/suit/SpiderOS.dm
@@ -211,7 +211,7 @@
if("Message")
var/obj/item/pda/P = locate(href_list["target"])
- var/t = input(U, "Please enter untraceable message.") as text
+ var/t = clean_input("Please enter untraceable message.", user=U)
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if(!t||U.stat||U.wear_suit!=src||!s_initialized)//Wow, another one of these. Man...
display_to << browse(null, "window=spideros")
diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm
index b161391f6e3..7c7fe156ca0 100644
--- a/code/modules/paperwork/folders.dm
+++ b/code/modules/paperwork/folders.dm
@@ -36,7 +36,7 @@
to_chat(user, "You put the [W] into \the [src].")
update_icon()
else if(istype(W, /obj/item/pen))
- var/n_name = input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text|null
+ var/n_name = clean_input("What would you like to label the folder?", "Folder Labelling", null)
if(!n_name)
return
n_name = sanitize(copytext(n_name, 1, MAX_NAME_LEN))
diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm
index 23a37e06409..cf021cb2618 100644
--- a/code/modules/paperwork/paper.dm
+++ b/code/modules/paperwork/paper.dm
@@ -215,7 +215,7 @@
/obj/item/paper/proc/parsepencode(var/t, var/obj/item/pen/P, mob/user as mob)
- t = pencode_to_html(t, usr, P, TRUE, TRUE, TRUE, deffont, signfont, crayonfont)
+ t = pencode_to_html(html_encode(t), usr, P, TRUE, TRUE, TRUE, deffont, signfont, crayonfont)
return t
/obj/item/paper/proc/populatefields()
@@ -285,7 +285,6 @@
message_admins("PAPER: [key_name_admin(usr)] tried to use forbidden word in [src]: [bad].")
return
*/
- t = html_encode(t)
t = parsepencode(t, i, usr) // Encode everything from pencode to html
if(id!="end")
diff --git a/code/modules/pda/cart_apps.dm b/code/modules/pda/cart_apps.dm
index a66e72d17a3..4ca5b4af427 100644
--- a/code/modules/pda/cart_apps.dm
+++ b/code/modules/pda/cart_apps.dm
@@ -21,9 +21,9 @@
if("alert")
post_status("alert", href_list["alert"])
if("setmsg1")
- message1 = input("Line 1", "Enter Message Text", message1) as text|null
+ message1 = clean_input("Line 1", "Enter Message Text", message1)
if("setmsg2")
- message2 = input("Line 2", "Enter Message Text", message2) as text|null
+ message2 = clean_input("Line 2", "Enter Message Text", message2)
else
post_status(href_list["statdisp"])
diff --git a/code/modules/procedural_mapping/mapGenerator.dm b/code/modules/procedural_mapping/mapGenerator.dm
index 645c6e786de..5c46ac20058 100644
--- a/code/modules/procedural_mapping/mapGenerator.dm
+++ b/code/modules/procedural_mapping/mapGenerator.dm
@@ -149,8 +149,8 @@
set category = "Debug"
var/datum/mapGenerator/nature/N = new()
- var/startInput = input(usr,"Start turf of Map, (X;Y;Z)", "Map Gen Settings", "1;1;1") as text
- var/endInput = input(usr,"End turf of Map (X;Y;Z)", "Map Gen Settings", "[world.maxx];[world.maxy];[mob ? mob.z : 1]") as text
+ var/startInput = clean_input("Start turf of Map, (X;Y;Z)", "Map Gen Settings", "1;1;1")
+ var/endInput = clean_input("End turf of Map (X;Y;Z)", "Map Gen Settings", "[world.maxx];[world.maxy];[mob ? mob.z : 1]")
//maxx maxy and current z so that if you fuck up, you only fuck up one entire z level instead of the entire universe
if(!startInput || !endInput)
to_chat(src, "Missing Input")
diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm
index e10cd5c9203..36605867781 100644
--- a/code/modules/reagents/chemistry/machinery/chem_master.dm
+++ b/code/modules/reagents/chemistry/machinery/chem_master.dm
@@ -249,7 +249,7 @@
var/amount_per_pill = reagents.total_volume / count
if(amount_per_pill > 100)
amount_per_pill = 100
- var/name = input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill]u)") as text|null
+ var/name = clean_input("Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill]u)")
if(!name)
return
name = reject_bad_text(name)
@@ -270,7 +270,7 @@
P.forceMove(loaded_pill_bottle)
updateUsrDialog()
else
- var/name = input(usr, "Name:", "Name your bag!", reagents.get_master_reagent_name()) as text|null
+ var/name = clean_input("Name:", "Name your bag!", reagents.get_master_reagent_name())
if(!name)
return
name = reject_bad_text(name)
@@ -295,7 +295,7 @@
var/amount_per_patch = reagents.total_volume/count
if(amount_per_patch > 40)
amount_per_patch = 40
- var/name = input(usr, "Name:", "Name your patch!", "[reagents.get_master_reagent_name()] ([amount_per_patch]u)") as text|null
+ var/name = clean_input("Name:", "Name your patch!", "[reagents.get_master_reagent_name()] ([amount_per_patch]u)")
if(!name)
return
name = reject_bad_text(name)
@@ -317,7 +317,7 @@
else if(href_list["createbottle"])
if(!condi)
- var/name = input(usr, "Name:", "Name your bottle!", reagents.get_master_reagent_name()) as text|null
+ var/name = clean_input("Name:", "Name your bottle!", reagents.get_master_reagent_name())
if(!name)
return
name = reject_bad_text(name)