diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index c00bb17b1d..918fee1389 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)>300) 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/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/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 066604834e..703ce04828 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -697,7 +697,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 b4b5ae4d51..511f86f7d5 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/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/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/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/computer/card.dm b/code/game/machinery/computer/card.dm index 53a65f65e4..4e97506088 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -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 c3e12d4a58..4015b907f9 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -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/security.dm b/code/game/machinery/computer/security.dm index 1e4979b657..c05f0f78be 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -426,7 +426,7 @@ 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 diff --git a/code/game/machinery/computer/skills.dm b/code/game/machinery/computer/skills.dm index 0c93c15bfc..aa92a59094 100644 --- a/code/game/machinery/computer/skills.dm +++ b/code/game/machinery/computer/skills.dm @@ -309,7 +309,7 @@ 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 diff --git a/code/game/machinery/computer3/computers/communications.dm b/code/game/machinery/computer3/computers/communications.dm index c8548bb933..f00b595c6c 100644 --- a/code/game/machinery/computer3/computers/communications.dm +++ b/code/game/machinery/computer3/computers/communications.dm @@ -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/security.dm b/code/game/machinery/computer3/computers/security.dm index 4c2f7369d2..e00aab556d 100644 --- a/code/game/machinery/computer3/computers/security.dm +++ b/code/game/machinery/computer3/computers/security.dm @@ -444,7 +444,7 @@ 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 diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 9f65c8235d..3a238e24b0 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -496,9 +496,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) usr.set_machine(src) if(href_list["set_channel_name"]) - src.channel_name = strip_html(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", "")) - while (findtext(src.channel_name," ") == 1) - src.channel_name = copytext(src.channel_name,2,lentext(src.channel_name)+1) + src.channel_name = sanitizeSafe(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", "")) src.updateUsrDialog() //src.update_icon() @@ -541,9 +539,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co src.updateUsrDialog() else if(href_list["set_new_message"]) - src.msg = strip_html(input(usr, "Write your Feed story", "Network Channel Handler", "")) - while (findtext(src.msg," ") == 1) - src.msg = copytext(src.msg,2,lentext(src.msg)+1) + src.msg = sanitize(input(usr, "Write your Feed story", "Network Channel Handler", "")) src.updateUsrDialog() else if(href_list["set_attachment"]) @@ -600,15 +596,11 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co src.updateUsrDialog() else if(href_list["set_wanted_name"]) - src.channel_name = strip_html(input(usr, "Provide the name of the Wanted person", "Network Security Handler", "")) - while (findtext(src.channel_name," ") == 1) - src.channel_name = copytext(src.channel_name,2,lentext(src.channel_name)+1) + src.channel_name = sanitizeSafe(input(usr, "Provide the name of the Wanted person", "Network Security Handler", "")) src.updateUsrDialog() else if(href_list["set_wanted_desc"]) - src.msg = strip_html(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", "")) - while (findtext(src.msg," ") == 1) - src.msg = copytext(src.msg,2,lentext(src.msg)+1) + src.msg = sanitize(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", "")) src.updateUsrDialog() else if(href_list["submit_wanted"]) @@ -944,7 +936,7 @@ obj/item/weapon/newspaper/attackby(obj/item/weapon/W as obj, mob/user as mob) if(src.scribble_page == src.curr_page) user << "There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?" else - var/s = strip_html( input(user, "Write something", "Newspaper", "") ) + var/s = sanitize(input(user, "Write something", "Newspaper", "")) s = sanitize(s) if (!s) return diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index b2bdadfdbe..c8d1014c9b 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -284,7 +284,7 @@ src.log_message("Interfaced with [src_object].") return STATUS_INTERACTIVE if(src_object in view(2, src)) - return STATUS_UPDATE //if they're close enough, allow the occupant to see the screen through the viewport or whatever. + return STATUS_UPDATE //if they're close enough, allow the occupant to see the screen through the viewport or whatever. /obj/mecha/proc/melee_action(atom/target) return @@ -1569,8 +1569,8 @@ return if (href_list["change_name"]) if(usr != src.occupant) return - var/newname = strip_html_simple(input(occupant,"Choose new exosuit name","Rename exosuit",initial(name)) as text, MAX_NAME_LEN) - if(newname && trim(newname)) + var/newname = sanitizeSafe(input(occupant,"Choose new exosuit name","Rename exosuit",initial(name)) as text, MAX_NAME_LEN) + if(newname) name = newname else alert(occupant, "nope.avi") diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm index 051f2e8129..8fa25a3568 100644 --- a/code/game/mecha/mecha_control_console.dm +++ b/code/game/mecha/mecha_control_console.dm @@ -43,9 +43,9 @@ var/datum/topic_input/filter = new /datum/topic_input(href,href_list) if(href_list["send_message"]) var/obj/item/mecha_parts/mecha_tracking/MT = filter.getObj("send_message") - var/message = strip_html_simple(input(usr,"Input message","Transmit message") as text) + var/message = sanitize(input(usr,"Input message","Transmit message") as text) var/obj/mecha/M = MT.in_mecha() - if(trim(message) && M) + if(message && M) M.occupant_message(message) return if(href_list["shock"]) diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index f0d8a820c0..facafe41f2 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -114,7 +114,7 @@ move an amendment to the drawing.

usr << "\red Error! Please notify administration!" return var/list/turf/turfs = res - var/str = trim(stripped_input(usr,"New area name:","Blueprint Editing", "", MAX_NAME_LEN)) + var/str = sanitizeSafe(input("New area name:","Blueprint Editing", ""), MAX_NAME_LEN) if(!str || !length(str)) //cancel return if(length(str) > 50) @@ -154,7 +154,7 @@ move an amendment to the drawing.

var/area/A = get_area() //world << "DEBUG: edit_area" var/prevname = "[A.name]" - var/str = trim(stripped_input(usr,"New area name:","Blueprint Editing", prevname, MAX_NAME_LEN)) + var/str = sanitizeSafe(input("New area name:","Blueprint Editing", prevname), MAX_NAME_LEN) if(!str || !length(str) || str==prevname) //cancel return if(length(str) > 50) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 0bc2139ae7..6dd7281b4f 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -689,7 +689,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if ("Edit") var/n = input(U, "Please enter message", name, notehtml) as message if (in_range(src, U) && loc == U) - n = copytext(adminscrub(n), 1, MAX_MESSAGE_LEN) + n = sanitizeSafe(n, extra = 0) if (mode == 1) note = html_decode(n) notehtml = note @@ -972,7 +972,8 @@ var/global/list/obj/item/device/pda/PDAs = list() U.last_target_click = world.time var/t = input(U, "Please enter message", P.name, null) as text t = sanitize(t) - t = readd_quotes(t) + //t = readd_quotes(t) + t = replace_characters(t, list(""" = "\"")) if (!t || !istype(P)) return if (!in_range(src, U) && loc != U) diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index cfd50c37d5..8deb8d7a50 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -233,7 +233,7 @@ user << "\blue The MMI must go in after everything else!" if (istype(W, /obj/item/weapon/pen)) - var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name, 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/objects/items/robot/robot_upgrades.dm b/code/game/objects/items/robot/robot_upgrades.dm index 3f11eb4bbe..43b852e249 100644 --- a/code/game/objects/items/robot/robot_upgrades.dm +++ b/code/game/objects/items/robot/robot_upgrades.dm @@ -53,7 +53,7 @@ var/heldname = "default name" /obj/item/borg/upgrade/rename/attack_self(mob/user as mob) - heldname = stripped_input(user, "Enter new robot name", "Robot Reclassification", heldname, MAX_NAME_LEN) + heldname = sanitizeSafe(input(user, "Enter new robot name", "Robot Reclassification", heldname), MAX_NAME_LEN) /obj/item/borg/upgrade/rename/action(var/mob/living/silicon/robot/R) if(..()) return 0 diff --git a/code/game/objects/items/weapons/AI_modules.dm b/code/game/objects/items/weapons/AI_modules.dm index 9d47d2b08b..7c1e5b6a40 100755 --- a/code/game/objects/items/weapons/AI_modules.dm +++ b/code/game/objects/items/weapons/AI_modules.dm @@ -98,7 +98,7 @@ AI MODULES /obj/item/weapon/aiModule/safeguard/attack_self(var/mob/user as mob) ..() - var/targName = stripped_input(usr, "Please enter the name of the person to safeguard.", "Safeguard who?", user.name) + var/targName = sanitize(input("Please enter the name of the person to safeguard.", "Safeguard who?", user.name)) targetName = targName desc = text("A 'safeguard' AI module: 'Safeguard []. Individuals that threaten [] are not human and are a threat to humans.'", targetName, targetName) @@ -127,7 +127,7 @@ AI MODULES /obj/item/weapon/aiModule/oneHuman/attack_self(var/mob/user as mob) ..() - var/targName = stripped_input(usr, "Please enter the name of the person who is the only human.", "Who?", user.real_name) + var/targName = sanitize(input("Please enter the name of the person who is the only human.", "Who?", user.real_name)) targetName = targName desc = text("A 'one human' AI module: 'Only [] is human.'", targetName) @@ -378,7 +378,7 @@ AI MODULES /obj/item/weapon/aiModule/freeformcore/attack_self(var/mob/user as mob) ..() var/newlaw = "" - var/targName = stripped_input(usr, "Please enter a new core law for the AI.", "Freeform Law Entry", newlaw) + var/targName = sanitize(input("Please enter a new core law for the AI.", "Freeform Law Entry", newlaw)) newFreeFormLaw = targName desc = "A 'freeform' Core AI module: '[newFreeFormLaw]'" @@ -403,7 +403,7 @@ AI MODULES /obj/item/weapon/aiModule/syndicate/attack_self(var/mob/user as mob) ..() var/newlaw = "" - var/targName = stripped_input(usr, "Please enter a new law for the AI.", "Freeform Law Entry", newlaw,MAX_MESSAGE_LEN) + var/targName = sanitize(input("Please enter a new law for the AI.", "Freeform Law Entry", newlaw)) newFreeFormLaw = targName desc = "A hacked AI law module: '[newFreeFormLaw]'" diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 9ad9b23f75..6a1ee735f4 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -224,7 +224,7 @@ /obj/item/weapon/card/id/syndicate/attack_self(mob/user as mob) if(!src.registered_name) //Stop giving the players unsanitized unputs! You are giving ways for players to intentionally crash clients! -Nodrak - var t = reject_bad_name(input(user, "What name would you like to put on this card?", "Agent card name", ishuman(user) ? user.real_name : user.name)) + var t = sanitizeName(input(user, "What name would you like to put on this card?", "Agent card name", ishuman(user) ? user.real_name : user.name)) if(!t) //Same as mob/new_player/prefrences.dm alert("Invalid name.") return diff --git a/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm b/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm index ff33485f72..e45f51a088 100644 --- a/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm +++ b/code/game/objects/items/weapons/circuitboards/computer/camera_monitor.dm @@ -52,7 +52,7 @@ user << "\red Circuit controls are locked." return var/existing_networks = list2text(network,",") - var/input = strip_html(input(usr, "Which networks would you like to connect this camera console circuit to? Seperate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Multitool-Circuitboard interface", existing_networks)) + var/input = sanitize(input(usr, "Which networks would you like to connect this camera console circuit to? Seperate networks with a comma. No Spaces!\nFor example: SS13,Security,Secret ", "Multitool-Circuitboard interface", existing_networks)) if(!input) usr << "No input found please hang up and try your call again." return diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm index c7c7e762ab..ea3b7d5752 100644 --- a/code/game/objects/items/weapons/implants/implant.dm +++ b/code/game/objects/items/weapons/implants/implant.dm @@ -152,7 +152,7 @@ Implant Specifics:
"} 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/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/modules/admin/admin.dm b/code/modules/admin/admin.dm index bbee0157d6..f956743dfa 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -728,7 +728,7 @@ var/global/floorIsLava = 0 var/message = input("Global message to send:", "Admin Announce", null, null) as message 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_verbs.dm b/code/modules/admin/admin_verbs.dm index 5fb0d5f231..3751b51277 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -708,7 +708,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 b40d441ef2..e8817031fe 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2426,9 +2426,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"]) @@ -2461,13 +2459,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"]) @@ -2509,15 +2505,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"]) @@ -2622,7 +2614,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"]) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 942cb9c107..7b969a332b 100755 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -1205,7 +1205,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 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/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/library/lib_items.dm b/code/modules/library/lib_items.dm index 04906983e1..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 ([sanitizeSafe(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/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/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/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index c3c2110872..3d1304ab55 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1205,7 +1205,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/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/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/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/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/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/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 2fab30fe45..c23927cca9 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -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