mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 03:57:48 +01:00
Merge pull request #8380 from volas/sanitize_procs
[DNM] sanitize() and text.dm refactoring
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user