Merge pull request #8380 from volas/sanitize_procs

[DNM] sanitize() and text.dm refactoring
This commit is contained in:
Zuhayr
2015-03-29 00:57:33 +10:30
124 changed files with 418 additions and 547 deletions
+1 -1
View File
@@ -181,7 +181,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
switch(param)
if("reason")
if(!value)
value = input("Insert the new reason for [pckey]'s ban", "New Reason", "[reason]", null) as null|text
value = sanitize(input("Insert the new reason for [pckey]'s ban", "New Reason", "[reason]", null) as null|text)
value = sql_sanitize_text(value)
if(!value)
usr << "Cancelled"
+2 -2
View File
@@ -725,10 +725,10 @@ var/global/floorIsLava = 0
set desc="Announce your desires to the world"
if(!check_rights(0)) return
var/message = input("Global message to send:", "Admin Announce", null, null) as message
var/message = input("Global message to send:", "Admin Announce", null, null) as message//todo: sanitize for all?
if(message)
if(!check_rights(R_SERVER,0))
message = adminscrub(message,500)
message = sanitize(message, 500, extra = 0)
world << "\blue <b>[usr.client.holder.fakekey ? "Administrator" : usr.key] Announces:</b>\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!
+1 -1
View File
@@ -16,7 +16,7 @@
/client/proc/admin_memo_write()
var/savefile/F = new(MEMOFILE)
if(F)
var/memo = input(src,"Type your memo\n(Leaving it blank will delete your current memo):","Write Memo",null) as null|message
var/memo = sanitize(input(src,"Type your memo\n(Leaving it blank will delete your current memo):","Write Memo",null) as null|message, extra = 0)
switch(memo)
if(null)
return
+2 -2
View File
@@ -617,7 +617,7 @@ var/list/admin_verbs_mentor = list(
set name = "Make Sound"
set desc = "Display a message to everyone who can hear the target"
if(O)
var/message = input("What do you want the message to be?", "Make Sound") as text|null
var/message = sanitize(input("What do you want the message to be?", "Make Sound") as text|null)
if(!message)
return
for (var/mob/V in hearers(O))
@@ -709,7 +709,7 @@ var/list/admin_verbs_mentor = list(
return
if(holder)
var/new_name = trim_strip_input(src, "Enter new name. Leave blank or as is to cancel.", "Enter new silicon name", S.real_name)
var/new_name = sanitizeSafe(input(src, "Enter new name. Leave blank or as is to cancel.", "Enter new silicon name", S.real_name))
if(new_name && new_name != S.real_name)
admin_log_and_message_admins("has renamed the silicon '[S.real_name]' to '[new_name]'")
S.SetName(new_name)
+17 -24
View File
@@ -328,12 +328,12 @@
mins = min(525599,mins)
minutes = CMinutes + mins
duration = GetExp(minutes)
reason = input(usr,"Reason?","reason",reason2) as text|null
reason = sanitize(input(usr,"Reason?","reason",reason2) as text|null)
if(!reason) return
if("No")
temp = 0
duration = "Perma"
reason = input(usr,"Reason?","reason",reason2) as text|null
reason = sanitize(input(usr,"Reason?","reason",reason2) as text|null)
if(!reason) return
log_admin("[key_name(usr)] edited [banned_key]'s ban. Reason: [reason] Duration: [duration]")
@@ -655,7 +655,7 @@
var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null
if(!mins)
return
var/reason = input(usr,"Reason?","Please State Reason","") as text|null
var/reason = sanitize(input(usr,"Reason?","Please State Reason","") as text|null)
if(!reason)
return
@@ -680,7 +680,7 @@
return 1
if("No")
if(!check_rights(R_BAN)) return
var/reason = input(usr,"Reason?","Please State Reason","") as text|null
var/reason = sanitize(input(usr,"Reason?","Please State Reason","") as text|null)
if(reason)
var/msg
for(var/job in notbannedlist)
@@ -737,7 +737,7 @@
if (ismob(M))
if(!check_if_greater_rights_than(M.client))
return
var/reason = input("Please enter reason")
var/reason = sanitize(input("Please enter reason"))
if(!reason)
M << "\red You have been kicked from the server"
else
@@ -794,7 +794,7 @@
if(!mins)
return
if(mins >= 525600) mins = 525599
var/reason = input(usr,"Reason?","reason","Griefer") as text|null
var/reason = sanitize(input(usr,"Reason?","reason","Griefer") as text|null)
if(!reason)
return
AddBan(M.ckey, M.computer_id, reason, usr.ckey, 1, mins)
@@ -815,7 +815,7 @@
//del(M) // See no reason why to delete mob. Important stuff can be lost. And ban can be lifted before round ends.
if("No")
if(!check_rights(R_BAN)) return
var/reason = input(usr,"Reason?","reason","Griefer") as text|null
var/reason = sanitize(input(usr,"Reason?","reason","Griefer") as text|null)
if(!reason)
return
switch(alert(usr,"IP ban?",,"Yes","No","Cancel"))
@@ -1341,7 +1341,7 @@
usr << "The person you are trying to contact is not wearing a headset"
return
var/input = input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from Centcomm", "")
var/input = sanitize(input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from Centcomm", ""))
if(!input) return
src.owner << "You sent [input] to [H] via a secure channel."
@@ -1358,7 +1358,7 @@
usr << "The person you are trying to contact is not wearing a headset"
return
var/input = input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from a shadowy figure...", "")
var/input = sanitize(input(src.owner, "Please enter a message to reply to [key_name(H)] via their headset.","Outgoing message from a shadowy figure...", ""))
if(!input) return
src.owner << "You sent [input] to [H] via a secure channel."
@@ -1405,6 +1405,7 @@
var/mob/sender = locate(href_list["CentcommFaxReply"])
var/obj/machinery/photocopier/faxmachine/fax = locate(href_list["originfax"])
//todo: sanitize
var/input = input(src.owner, "Please enter a message to reply to [key_name(sender)] via secure connection. NOTE: BBCode does not work, but HTML tags do! Use <br> for line breaks.", "Outgoing message from Centcomm", "") as message|null
if(!input) return
@@ -2388,9 +2389,7 @@
src.access_news_network()
else if(href_list["ac_set_channel_name"])
src.admincaster_feed_channel.channel_name = strip_html_simple(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", ""))
while (findtext(src.admincaster_feed_channel.channel_name," ") == 1)
src.admincaster_feed_channel.channel_name = copytext(src.admincaster_feed_channel.channel_name,2,lentext(src.admincaster_feed_channel.channel_name)+1)
src.admincaster_feed_channel.channel_name = sanitizeSafe(input(usr, "Provide a Feed Channel Name", "Network Channel Handler", ""))
src.access_news_network()
else if(href_list["ac_set_channel_lock"])
@@ -2423,13 +2422,11 @@
var/list/available_channels = list()
for(var/datum/feed_channel/F in news_network.network_channels)
available_channels += F.channel_name
src.admincaster_feed_channel.channel_name = adminscrub(input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels )
src.admincaster_feed_channel.channel_name = sanitizeSafe(input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels )
src.access_news_network()
else if(href_list["ac_set_new_message"])
src.admincaster_feed_message.body = adminscrub(input(usr, "Write your Feed story", "Network Channel Handler", ""))
while (findtext(src.admincaster_feed_message.body," ") == 1)
src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,lentext(src.admincaster_feed_message.body)+1)
src.admincaster_feed_message.body = sanitize(input(usr, "Write your Feed story", "Network Channel Handler", ""))
src.access_news_network()
else if(href_list["ac_submit_new_message"])
@@ -2471,15 +2468,11 @@
src.access_news_network()
else if(href_list["ac_set_wanted_name"])
src.admincaster_feed_message.author = adminscrub(input(usr, "Provide the name of the Wanted person", "Network Security Handler", ""))
while (findtext(src.admincaster_feed_message.author," ") == 1)
src.admincaster_feed_message.author = copytext(admincaster_feed_message.author,2,lentext(admincaster_feed_message.author)+1)
src.admincaster_feed_message.author = sanitize(input(usr, "Provide the name of the Wanted person", "Network Security Handler", ""))
src.access_news_network()
else if(href_list["ac_set_wanted_desc"])
src.admincaster_feed_message.body = adminscrub(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", ""))
while (findtext(src.admincaster_feed_message.body," ") == 1)
src.admincaster_feed_message.body = copytext(src.admincaster_feed_message.body,2,lentext(src.admincaster_feed_message.body)+1)
src.admincaster_feed_message.body = sanitize(input(usr, "Provide the a description of the Wanted person and any other details you deem important", "Network Security Handler", ""))
src.access_news_network()
else if(href_list["ac_submit_wanted"])
@@ -2584,7 +2577,7 @@
src.access_news_network()
else if(href_list["ac_set_signature"])
src.admincaster_signature = adminscrub(input(usr, "Provide your desired signature", "Network Identity Handler", ""))
src.admincaster_signature = sanitize(input(usr, "Provide your desired signature", "Network Identity Handler", ""))
src.access_news_network()
else if(href_list["populate_inactive_customitems"])
@@ -2622,7 +2615,7 @@
if(href_list["add_player_info"])
var/key = href_list["add_player_info"]
var/add = input("Add Player Info") as null|text
var/add = sanitize(input("Add Player Info") as null|text)
if(!add) return
notes_add(key,add,usr)
+2 -2
View File
@@ -23,7 +23,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
//clean the input msg
if(!msg)
return
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
msg = sanitize(msg)
if(!msg)
return
var/original_msg = msg
@@ -88,7 +88,7 @@ var/list/adminhelp_ignored_words = list("unknown","the","a","an","of","monkey","
if(ai_found)
ai_cl = " (<A HREF='?_src_=holder;adminchecklaws=\ref[mob]'>CL</A>)"
//Options bar: mob, details ( admin = 2, dev = 3, mentor = 4, character name (0 = just ckey, 1 = ckey and character name), link? (0 no don't make it a link, 1 do so),
//Options bar: mob, details ( admin = 2, dev = 3, mentor = 4, character name (0 = just ckey, 1 = ckey and character name), link? (0 no don't make it a link, 1 do so),
// highlight special roles (0 = everyone has same looking name, 1 = antags / special roles get a golden name)
var/mentor_msg = "\blue <b><font color=red>Request for Help: </font>[get_options_bar(mob, 4, 1, 1, 0)][ai_cl]:</b> [msg]"
+3 -2
View File
@@ -60,8 +60,9 @@
return
//clean the message if it's not sent by a high-rank admin
//todo: sanitize for all???
if(!check_rights(R_SERVER|R_DEBUG,0))
msg = sanitize(copytext(msg,1,MAX_MESSAGE_LEN))
msg = sanitize(msg)
if(!msg) return
var/recieve_pm_type = "Player"
@@ -91,7 +92,7 @@
spawn(0) //so we don't hold the caller proc up
var/sender = src
var/sendername = key
var/reply = input(C, msg,"[recieve_pm_type] PM from [sendername]", "") as text|null //show message and await a reply
var/reply = sanitize(input(C, msg,"[recieve_pm_type] PM from [sendername]", "") as text|null) //show message and await a reply
if(C && reply)
if(sender)
C.cmd_admin_pm(sender,reply) //sender is still about, let's reply to them
+2 -2
View File
@@ -4,7 +4,7 @@
set hidden = 1
if(!check_rights(R_ADMIN)) return
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
msg = sanitize(msg)
if(!msg) return
log_admin("[key_name(src)] : [msg]")
@@ -23,7 +23,7 @@
if(!check_rights(R_ADMIN|R_MOD|R_MENTOR)) return
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
msg = sanitize(msg)
log_admin("MOD: [key_name(src)] : [msg]")
if (!msg)
+1 -1
View File
@@ -5,7 +5,7 @@
if(!check_rights(R_ADMIN)) return
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
msg = sanitize(msg)
if(!msg) return
var/display_name = src.key
+3 -3
View File
@@ -7,7 +7,7 @@
src << "Only administrators may use this command."
return
var/input = input(usr, "Enter the description of the custom event. Be descriptive. To cancel the event, make this blank or hit cancel.", "Custom Event", custom_event_msg) as message|null
var/input = sanitize(input(usr, "Enter the description of the custom event. Be descriptive. To cancel the event, make this blank or hit cancel.", "Custom Event", custom_event_msg) as message|null, MAX_BOOK_MESSAGE_LEN, extra = 0)
if(!input || input == "")
custom_event_msg = null
log_admin("[usr.key] has cleared the custom event text.")
@@ -21,7 +21,7 @@
world << "<h1 class='alert'>Custom Event</h1>"
world << "<h2 class='alert'>A custom event is starting. OOC Info:</h2>"
world << "<span class='alert'>[html_encode(custom_event_msg)]</span>"
world << "<span class='alert'>[custom_event_msg]</span>"
world << "<br>"
// normal verb for players to view info
@@ -36,5 +36,5 @@
src << "<h1 class='alert'>Custom Event</h1>"
src << "<h2 class='alert'>A custom event is taking place. OOC Info:</h2>"
src << "<span class='alert'>[html_encode(custom_event_msg)]</span>"
src << "<span class='alert'>[custom_event_msg]</span>"
src << "<br>"
+1 -1
View File
@@ -29,7 +29,7 @@
if (src.holder.rights & R_ADMIN)
stafftype = "ADMIN"
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
msg = sanitize(msg)
log_admin("[key_name(src)] : [msg]")
if (!msg)
+1 -1
View File
@@ -205,7 +205,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return 0
var/obj/item/device/paicard/card = new(T)
var/mob/living/silicon/pai/pai = new(card)
pai.name = input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text
pai.name = sanitizeSafe(input(choice, "Enter your pAI name:", "pAI Name", "Personal AI") as text)
pai.real_name = pai.name
pai.key = choice.key
card.setPersonality(pai)
+1 -1
View File
@@ -168,7 +168,7 @@
return .(O.vars[variable])
if("text")
var/new_value = input("Enter new text:","Text",O.vars[variable]) as text|null
var/new_value = input("Enter new text:","Text",O.vars[variable]) as text|null//todo: sanitize ???
if(new_value == null) return
O.vars[variable] = new_value
+4 -4
View File
@@ -44,7 +44,7 @@ var/list/forbidden_varedit_object_types = list(
switch(class)
if("text")
var_value = input("Enter new text:","Text") as null|text
var_value = input("Enter new text:","Text") as null|text//todo: sanitize ???
if("num")
var_value = input("Enter new number:","Num") as null|num
@@ -93,7 +93,7 @@ var/list/forbidden_varedit_object_types = list(
switch(class)
if("text")
var_value = input("Enter new text:","Text") as text
var_value = input("Enter new text:","Text") as text//todo: sanitize ???
if("num")
var_value = input("Enter new number:","Num") as num
@@ -243,7 +243,7 @@ var/list/forbidden_varedit_object_types = list(
return
if("text")
L[L.Find(variable)] = input("Enter new text:","Text") as text
L[L.Find(variable)] = input("Enter new text:","Text") as text//todo: sanitize ???
if("num")
L[L.Find(variable)] = input("Enter new number:","Num") as num
@@ -450,7 +450,7 @@ var/list/forbidden_varedit_object_types = list(
return .(O.vars[variable])
if("text")
var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|text
var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|text//todo: sanitize ???
if(var_new==null) return
O.vars[variable] = var_new
+3 -3
View File
@@ -6,7 +6,7 @@
usr << "\red Speech is currently admin-disabled."
return
msg = sanitize(copytext(msg, 1, MAX_MESSAGE_LEN))
msg = sanitize(msg)
if(!msg) return
if(usr.client)
@@ -29,14 +29,14 @@
//log_admin("HELP: [key_name(src)]: [msg]")
/proc/Centcomm_announce(var/text , var/mob/Sender , var/iamessage)
var/msg = sanitize(copytext(text, 1, MAX_MESSAGE_LEN))
var/msg = sanitize(text)
msg = "\blue <b><font color=orange>CENTCOMM[iamessage ? " IA" : ""]:</font>[key_name(Sender, 1)] (<A HREF='?_src_=holder;adminplayeropts=\ref[Sender]'>PP</A>) (<A HREF='?_src_=vars;Vars=\ref[Sender]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=\ref[Sender]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=\ref[Sender]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) (<A HREF='?_src_=holder;BlueSpaceArtillery=\ref[Sender]'>BSA</A>) (<A HREF='?_src_=holder;CentcommReply=\ref[Sender]'>RPLY</A>):</b> [msg]"
for(var/client/C in admins)
if(R_ADMIN & C.holder.rights)
C << msg
/proc/Syndicate_announce(var/text , var/mob/Sender)
var/msg = sanitize(copytext(text, 1, MAX_MESSAGE_LEN))
var/msg = sanitize(text)
msg = "\blue <b><font color=crimson>ILLEGAL:</font>[key_name(Sender, 1)] (<A HREF='?_src_=holder;adminplayeropts=\ref[Sender]'>PP</A>) (<A HREF='?_src_=vars;Vars=\ref[Sender]'>VV</A>) (<A HREF='?_src_=holder;subtlemessage=\ref[Sender]'>SM</A>) (<A HREF='?_src_=holder;adminplayerobservejump=\ref[Sender]'>JMP</A>) (<A HREF='?_src_=holder;secretsadmin=check_antagonist'>CA</A>) (<A HREF='?_src_=holder;BlueSpaceArtillery=\ref[Sender]'>BSA</A>) (<A HREF='?_src_=holder;SyndicateReply=\ref[Sender]'>RPLY</A>):</b> [msg]"
for(var/client/C in admins)
if(R_ADMIN & C.holder.rights)
+6 -6
View File
@@ -52,7 +52,7 @@
src << "Only administrators may use this command."
return
var/msg = input("Message:", text("Subtle PM to [M.key]")) as text
var/msg = sanitize(input("Message:", text("Subtle PM to [M.key]")) as text)
if (!msg)
return
@@ -109,7 +109,7 @@
src << "Only administrators may use this command."
return
var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text
var/msg = sanitize(input("Message:", text("Enter the text you wish to appear to everyone:")) as text)
if (!msg)
return
@@ -132,7 +132,7 @@
if(!M)
return
var/msg = input("Message:", text("Enter the text you wish to appear to your target:")) as text
var/msg = sanitize(input("Message:", text("Enter the text you wish to appear to your target:")) as text)
if( !msg )
return
@@ -462,7 +462,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(!holder)
src << "Only administrators may use this command."
return
var/input = input(usr, "Please enter anything you want the AI to do. Anything. Serious.", "What?", "") as text|null
var/input = sanitize(input(usr, "Please enter anything you want the AI to do. Anything. Serious.", "What?", "") as text|null)
if(!input)
return
for(var/mob/living/silicon/ai/M in mob_list)
@@ -510,8 +510,8 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(!holder)
src << "Only administrators may use this command."
return
var/input = input(usr, "Please enter anything you want. Anything. Serious.", "What?", "") as message|null
var/customname = input(usr, "Pick a title for the report.", "Title") as text|null
var/input = sanitize(input(usr, "Please enter anything you want. Anything. Serious.", "What?", "") as message|null, extra = 0)
var/customname = sanitizeSafe(input(usr, "Pick a title for the report.", "Title") as text|null)
if(!input)
return
if(!customname)
+1 -1
View File
@@ -43,7 +43,7 @@ var/const/commandos_possible = 6 //if more Commandos are needed in the future
choice = null
while(!choice)
choice = sanitize(copytext(input(src, "Please specify which mission the strike team shall undertake.", "Specify Mission", ""),1,MAX_MESSAGE_LEN))
choice = sanitize(input(src, "Please specify which mission the strike team shall undertake.", "Specify Mission", ""))
if(!choice)
if(alert("Error, no mission set. Do you want to exit the setup process?",,"Yes","No")=="Yes")
return
+1 -1
View File
@@ -145,7 +145,7 @@
if(custom_event_msg && custom_event_msg != "")
src << "<h1 class='alert'>Custom Event</h1>"
src << "<h2 class='alert'>A custom event is taking place. OOC Info:</h2>"
src << "<span class='alert'>[html_encode(custom_event_msg)]</span>"
src << "<span class='alert'>[custom_event_msg]</span>"
src << "<br>"
if( (world.address == address || !address) && !host )
+14 -42
View File
@@ -995,16 +995,10 @@ datum/preferences
ShowChoices(user)
return
if("general")
var/msg = input(usr,"Give a general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message
if(msg != null)
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
var/msg = sanitize(input(usr,"Give a general description of your character. This will be shown regardless of clothing, and may include OOC notes and preferences.","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message, extra = 0)
flavor_texts[href_list["task"]] = msg
else
var/msg = input(usr,"Set the flavor text for your [href_list["task"]].","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message
if(msg != null)
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
var/msg = sanitize(input(usr,"Set the flavor text for your [href_list["task"]].","Flavor Text",html_decode(flavor_texts[href_list["task"]])) as message, extra = 0)
flavor_texts[href_list["task"]] = msg
SetFlavorText(user)
return
@@ -1019,16 +1013,10 @@ datum/preferences
ShowChoices(user)
return
if("Default")
var/msg = input(usr,"Set the default flavour text for your robot. It will be used for any module without individual setting.","Flavour Text",html_decode(flavour_texts_robot["Default"])) as message
if(msg != null)
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
var/msg = sanitize(input(usr,"Set the default flavour text for your robot. It will be used for any module without individual setting.","Flavour Text",html_decode(flavour_texts_robot["Default"])) as message, extra = 0)
flavour_texts_robot[href_list["task"]] = msg
else
var/msg = input(usr,"Set the flavour text for your robot with [href_list["task"]] module. If you leave this empty, default flavour text will be used for this module.","Flavour Text",html_decode(flavour_texts_robot[href_list["task"]])) as message
if(msg != null)
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = html_encode(msg)
var/msg = sanitize(input(usr,"Set the flavour text for your robot with [href_list["task"]] module. If you leave this empty, default flavour text will be used for this module.","Flavour Text",html_decode(flavour_texts_robot[href_list["task"]])) as message, extra = 0)
flavour_texts_robot[href_list["task"]] = msg
SetFlavourTextRobot(user)
return
@@ -1044,41 +1032,25 @@ datum/preferences
else
user << browse(null, "window=records")
if(href_list["task"] == "med_record")
var/medmsg = input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message
var/medmsg = sanitize(input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0)
if(medmsg != null)
medmsg = copytext(medmsg, 1, MAX_PAPER_MESSAGE_LEN)
medmsg = html_encode(medmsg)
med_record = medmsg
SetRecords(user)
if(href_list["task"] == "sec_record")
var/secmsg = input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message
var/secmsg = sanitize(input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0)
if(secmsg != null)
secmsg = copytext(secmsg, 1, MAX_PAPER_MESSAGE_LEN)
secmsg = html_encode(secmsg)
sec_record = secmsg
SetRecords(user)
if(href_list["task"] == "gen_record")
var/genmsg = input(usr,"Set your employment notes here.","Employment Records",html_decode(gen_record)) as message
var/genmsg = sanitize(input(usr,"Set your employment notes here.","Employment Records",html_decode(gen_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0)
if(genmsg != null)
genmsg = copytext(genmsg, 1, MAX_PAPER_MESSAGE_LEN)
genmsg = html_encode(genmsg)
gen_record = genmsg
SetRecords(user)
if(href_list["task"] == "exploitable_record")
var/exploitmsg = input(usr,"Set exploitable information about you here.","Exploitable Information",html_decode(exploit_record)) as message
var/exploitmsg = sanitize(input(usr,"Set exploitable information about you here.","Exploitable Information",html_decode(exploit_record)) as message, MAX_PAPER_MESSAGE_LEN, extra = 0)
if(exploitmsg != null)
exploitmsg = copytext(exploitmsg, 1, MAX_PAPER_MESSAGE_LEN)
exploitmsg = html_encode(exploitmsg)
exploit_record = exploitmsg
SetAntagoptions(user)
@@ -1205,7 +1177,7 @@ datum/preferences
if("name")
var/raw_name = input(user, "Choose your character's name:", "Character Preference") as text|null
if (!isnull(raw_name)) // Check to ensure that the user entered text (rather than cancel.)
var/new_name = reject_bad_name(raw_name)
var/new_name = sanitizeName(raw_name)
if(new_name)
real_name = new_name
else
@@ -1291,7 +1263,7 @@ datum/preferences
if("metadata")
var/new_metadata = input(user, "Enter any information you'd like others to see, such as Roleplay-preferences:", "Game Preference" , metadata) as message|null
if(new_metadata)
metadata = sanitize(copytext(new_metadata,1,MAX_MESSAGE_LEN))
metadata = sanitize(new_metadata)
if("b_type")
var/new_b_type = input(user, "Choose your character's blood-type:", "Character Preference") as null|anything in list( "A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-" )
@@ -1504,7 +1476,7 @@ datum/preferences
if(choice == "Other")
var/raw_choice = input(user, "Please enter a home system.") as text|null
if(raw_choice)
home_system = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN))
home_system = sanitize(raw_choice)
return
home_system = choice
if("citizenship")
@@ -1514,7 +1486,7 @@ datum/preferences
if(choice == "Other")
var/raw_choice = input(user, "Please enter your current citizenship.", "Character Preference") as text|null
if(raw_choice)
citizenship = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN))
citizenship = sanitize(raw_choice)
return
citizenship = choice
if("faction")
@@ -1524,7 +1496,7 @@ datum/preferences
if(choice == "Other")
var/raw_choice = input(user, "Please enter a faction.") as text|null
if(raw_choice)
faction = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN))
faction = sanitize(raw_choice)
return
faction = choice
if("religion")
@@ -1534,7 +1506,7 @@ datum/preferences
if(choice == "Other")
var/raw_choice = input(user, "Please enter a religon.") as text|null
if(raw_choice)
religion = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN))
religion = sanitize(raw_choice)
return
religion = choice
else
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -21,7 +21,7 @@
set category = "Object"
set src in usr
var/voice = sanitize(copytext(name,1,MAX_MESSAGE_LEN))
var/voice = sanitize(name, MAX_NAME_LEN)
if(!voice || !length(voice)) return
changer.voice = voice
usr << "<span class='notice'>You are now mimicking <B>[changer.voice]</B>.</span>"
@@ -133,7 +133,7 @@
/obj/item/rig_module/chem_dispenser/ninja
interface_desc = "Dispenses loaded chemicals directly into the wearer's bloodstream. This variant is made to be extremely light and flexible."
//just over a syringe worth of each. Want more? Go refill. Gives the ninja another reason to have to show their face.
charges = list(
list("tricordrazine", "tricordrazine", 0, 20),
@@ -280,10 +280,10 @@
voice_holder.active = 0
usr << "<font color='blue'>You disable the speech synthesiser.</font>"
if("Set Name")
var/raw_choice = input(usr, "Please enter a new name.") as text|null
var/raw_choice = sanitize(input(usr, "Please enter a new name.") as text|null)
if(!raw_choice)
return 0
voice_holder.voice = sanitize(copytext(raw_choice,1,MAX_MESSAGE_LEN))
voice_holder.voice = raw_choice
usr << "<font color='blue'>You are now mimicking <B>[voice_holder.voice]</B>.</font>"
return 1
@@ -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)
+2 -2
View File
@@ -167,7 +167,7 @@
if("change_id")
var/attempt_code = text2num(input("Re-enter the current EFTPOS access code", "Confirm EFTPOS code"))
if(attempt_code == access_code)
eftpos_name = input("Enter a new terminal ID for this device", "Enter new EFTPOS ID") + " EFTPOS scanner"
eftpos_name = sanitize(input("Enter a new terminal ID for this device", "Enter new EFTPOS ID")) + " EFTPOS scanner"
print_reference()
else
usr << "\icon[src]<span class='warning'>Incorrect code entered.</span>"
@@ -182,7 +182,7 @@
else
usr << "\icon[src]<span class='warning'>Account not found.</span>"
if("trans_purpose")
var/choice = input("Enter reason for EFTPOS transaction", "Transaction purpose")
var/choice = sanitize(input("Enter reason for EFTPOS transaction", "Transaction purpose"))
if(choice) transaction_purpose = choice
if("trans_value")
var/try_num = input("Enter amount for EFTPOS transaction", "Transaction amount") as num
+1 -1
View File
@@ -233,7 +233,7 @@
else if(href_list["back"])
selected_event_container = null
else if(href_list["set_name"])
var/name = input("Enter event name.", "Set Name") as text|null
var/name = sanitize(input("Enter event name.", "Set Name") as text|null)
if(name)
var/datum/event_meta/EM = locate(href_list["set_name"])
EM.name = name
+5 -5
View File
@@ -31,11 +31,11 @@
O.loc = src
update_icon()
else if(istype(O, /obj/item/weapon/pen))
var/newname = stripped_input(usr, "What would you like to title this bookshelf?")
var/newname = sanitizeSafe(input("What would you like to title this bookshelf?"), MAX_MESSAGE_LEN)
if(!newname)
return
else
name = ("bookcase ([sanitize(newname)])")
name = ("bookcase ([newname])")
else
..()
@@ -174,7 +174,7 @@
var/choice = input("What would you like to change?") in list("Title", "Contents", "Author", "Cancel")
switch(choice)
if("Title")
var/newtitle = reject_bad_text(stripped_input(usr, "Write a new title:"))
var/newtitle = reject_bad_text(sanitizeSafe(input("Write a new title:")))
if(!newtitle)
usr << "The title is invalid."
return
@@ -182,14 +182,14 @@
src.name = newtitle
src.title = newtitle
if("Contents")
var/content = strip_html(input(usr, "Write your book's contents (HTML NOT allowed):"),8192) as message|null
var/content = sanitize(input("Write your book's contents (HTML NOT allowed):") as message|null, MAX_BOOK_MESSAGE_LEN)
if(!content)
usr << "The content is invalid."
return
else
src.dat += content
if("Author")
var/newauthor = stripped_input(usr, "Write the author's name:")
var/newauthor = sanitize(input(usr, "Write the author's name:"))
if(!newauthor)
usr << "The name is invalid."
return
+4 -4
View File
@@ -300,12 +300,12 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
if(checkoutperiod < 1)
checkoutperiod = 1
if(href_list["editbook"])
buffer_book = sanitize(copytext(input("Enter the book's title:") as text|null,1,MAX_MESSAGE_LEN))
buffer_book = sanitizeSafe(input("Enter the book's title:") as text|null)
if(href_list["editmob"])
buffer_mob = sanitize(copytext(input("Enter the recipient's name:") as text|null,1,MAX_NAME_LEN))
buffer_mob = sanitize(input("Enter the recipient's name:") as text|null, MAX_NAME_LEN)
if(href_list["checkout"])
var/datum/borrowbook/b = new /datum/borrowbook
b.bookname = sanitize(buffer_book)
b.bookname = sanitizeSafe(buffer_book)
b.mobname = sanitize(buffer_mob)
b.getdate = world.time
b.duedate = world.time + (checkoutperiod * 600)
@@ -317,7 +317,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
var/obj/item/weapon/book/b = locate(href_list["delbook"])
inventory.Remove(b)
if(href_list["setauthor"])
var/newauthor = sanitize(copytext(input("Enter the author's name: ") as text|null,1,MAX_MESSAGE_LEN))
var/newauthor = sanitize(input("Enter the author's name: ") as text|null)
if(newauthor)
scanner.cache.author = newauthor
if(href_list["setcategory"])
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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"
+5 -11
View File
@@ -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]"
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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)
+1 -4
View File
@@ -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()
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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)
+5 -5
View File
@@ -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
+1 -1
View File
@@ -35,7 +35,7 @@
user << "<span class='notice'>You put the [W] into \the [src].</span>"
update_icon()
else if(istype(W, /obj/item/weapon/pen))
var/n_name = sanitize(copytext(input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text, 1, MAX_NAME_LEN))
var/n_name = sanitizeSafe(input(usr, "What would you like to label the folder?", "Folder Labelling", null) as text, MAX_NAME_LEN)
if((loc == usr && usr.stat == 0))
name = "folder[(n_name ? text("- '[n_name]'") : null)]"
return
+3 -3
View File
@@ -86,7 +86,7 @@
if((CLUMSY in usr.mutations) && prob(50))
usr << "<span class='warning'>You cut yourself on the paper.</span>"
return
var/n_name = sanitize(copytext(input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text, 1, MAX_NAME_LEN))
var/n_name = sanitizeSafe(input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text, MAX_NAME_LEN)
if((loc == usr && usr.stat == 0))
name = "[(n_name ? text("[n_name]") : initial(name))]"
if(name != "paper")
@@ -324,7 +324,7 @@
if(href_list["write"])
var/id = href_list["write"]
//var/t = strip_html_simple(input(usr, "What text do you wish to add to " + (id=="end" ? "the end of the paper" : "field "+id) + "?", "[name]", null),8192) as message
var/t = strip_html_simple(input("Enter what you want to write:", "Write", null, null) as message, MAX_PAPER_MESSAGE_LEN)
var/t = sanitize(input("Enter what you want to write:", "Write", null, null) as message, MAX_PAPER_MESSAGE_LEN, extra = 0)
var/obj/item/i = usr.get_active_hand() // Check to see if he still got that darn pen, also check if he's using a crayon or pen.
var/iscrayon = 0
if(!istype(i, /obj/item/weapon/pen))
@@ -347,7 +347,7 @@
message_admins("PAPER: [usr] ([usr.ckey]) tried to use forbidden word in [src]: [bad].")
return
*/
t = html_encode(t)
//t = html_encode(t)
t = replacetext(t, "\n", "<BR>")
t = parsepencode(t, i, usr, iscrayon) // Encode everything from pencode to html
+1 -1
View File
@@ -192,7 +192,7 @@
set category = "Object"
set src in usr
var/n_name = sanitize(copytext(input(usr, "What would you like to label the bundle?", "Bundle Labelling", null) as text, 1, MAX_NAME_LEN))
var/n_name = sanitizeSafe(input(usr, "What would you like to label the bundle?", "Bundle Labelling", null) as text, MAX_NAME_LEN)
if((loc == usr && usr.stat == 0))
name = "[(n_name ? text("[n_name]") : "paper")]"
add_fingerprint(usr)
+1 -1
View File
@@ -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"
+2 -2
View File
@@ -43,7 +43,7 @@ var/global/photo_count = 0
/obj/item/weapon/photo/attackby(obj/item/weapon/P as obj, mob/user as mob)
if(istype(P, /obj/item/weapon/pen) || istype(P, /obj/item/toy/crayon))
var/txt = sanitize(copytext(input(user, "What would you like to write on the back?", "Photo Writing", null) as text, 1, 128))
var/txt = sanitize(input(user, "What would you like to write on the back?", "Photo Writing", null) as text, 128)
if(loc == user && user.stat == 0)
scribble = txt
..()
@@ -70,7 +70,7 @@ var/global/photo_count = 0
set category = "Object"
set src in usr
var/n_name = sanitize(copytext(input(usr, "What would you like to label the photo?", "Photo Labelling", null) as text, 1, MAX_NAME_LEN))
var/n_name = sanitizeSafe(input(usr, "What would you like to label the photo?", "Photo Labelling", null) as text, MAX_NAME_LEN)
//loc.loc check is for making possible renaming photos in clipboards
if(( (loc == usr || (loc.loc && loc.loc == usr)) && usr.stat == 0))
name = "[(n_name ? text("[n_name]") : "photo")]"
+8 -8
View File
@@ -31,9 +31,9 @@
if(!BB)
user << "\blue There is no bullet in the casing to inscribe anything into."
return
var/tmp_label = ""
var/label_text = sanitize(copytext(input(user, "Inscribe some text into \the [initial(BB.name)]","Inscription",tmp_label), 1, MAX_NAME_LEN))
var/label_text = sanitizeSafe(input(user, "Inscribe some text into \the [initial(BB.name)]","Inscription",tmp_label), MAX_NAME_LEN)
if(length(label_text) > 20)
user << "\red The inscription can be at most 20 characters long."
else if(!label_text)
@@ -54,7 +54,7 @@
//Gun loading types
#define SINGLE_CASING 1 //The gun only accepts ammo_casings. ammo_magazines should never have this as their mag_type.
#define SPEEDLOADER 2 //Transfers casings from the mag to the gun when used.
#define SPEEDLOADER 2 //Transfers casings from the mag to the gun when used.
#define MAGAZINE 4 //The magazine item itself goes inside the gun
//An item that holds casings and can be used to put them inside guns
@@ -71,15 +71,15 @@
w_class = 2
throw_speed = 4
throw_range = 10
var/list/stored_ammo = list()
var/mag_type = SPEEDLOADER //ammo_magazines can only be used with compatible guns. This is not a bitflag, the load_method var on guns is.
var/caliber = "357"
var/max_ammo = 7
var/ammo_type = /obj/item/ammo_casing //ammo type that is initially loaded
var/initial_ammo = null
var/multiple_sprites = 0
//because BYOND doesn't support numbers as keys in associative lists
var/list/icon_keys = list() //keys
@@ -145,10 +145,10 @@
var/typestr = "[M.type]"
if(!(typestr in magazine_icondata_keys) || !(typestr in magazine_icondata_states))
magazine_icondata_cache_add(M)
M.icon_keys = magazine_icondata_keys[typestr]
M.ammo_states = magazine_icondata_states[typestr]
/proc/magazine_icondata_cache_add(var/obj/item/ammo_magazine/M)
var/list/icon_keys = list()
var/list/ammo_states = list()
@@ -22,7 +22,7 @@
M << "<span class='notice'>You don't feel cool enough to name this gun, chump.</span>"
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
@@ -34,7 +34,7 @@
M << "<span class='notice'>You don't feel cool enough to name this gun, chump.</span>"
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
+4 -4
View File
@@ -178,7 +178,7 @@
var/amount_per_pill = reagents.total_volume/count
if (amount_per_pill > 60) amount_per_pill = 60
var/name = reject_bad_text(input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill] units)"))
var/name = sanitizeSafe(input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill] units)"), MAX_NAME_LEN)
if(reagents.total_volume/count < 1) //Sanity checking.
return
@@ -197,7 +197,7 @@
else if (href_list["createbottle"])
if(!condi)
var/name = reject_bad_text(input(usr,"Name:","Name your bottle!",reagents.get_master_reagent_name()))
var/name = sanitizeSafe(input(usr,"Name:","Name your bottle!",reagents.get_master_reagent_name()), MAX_NAME_LEN)
var/obj/item/weapon/reagent_containers/glass/bottle/P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc)
if(!name) name = reagents.get_master_reagent_name()
P.name = "[name] bottle"
@@ -406,7 +406,7 @@
if(type in diseases) // Make sure this is a disease
D = new type(0, null)
var/list/data = list("viruses"=list(D))
var/name = sanitize(input(usr,"Name:","Name the culture",D.name))
var/name = sanitizeSafe(input(usr,"Name:","Name the culture",D.name))
if(!name || name == " ") name = D.name
B.name = "[name] culture bottle"
B.desc = "A small bottle. Contains [D.agent] culture in synthblood medium."
@@ -435,7 +435,7 @@
src.updateUsrDialog()
return
else if(href_list["name_disease"])
var/new_name = stripped_input(usr, "Name the Disease", "New Name", "", MAX_NAME_LEN)
var/new_name = sanitizeSafe(input(usr, "Name the Disease", "New Name", ""), MAX_NAME_LEN)
if(stat & (NOPOWER|BROKEN)) return
if(usr.stat || usr.restrained()) return
if(!in_range(src, usr)) return
@@ -2781,7 +2781,7 @@
if( src.open )
return
var/t = input("Enter what you want to add to the tag:", "Write", null, null) as text
var/t = sanitize(input("Enter what you want to add to the tag:", "Write", null, null) as text, 30)
var/obj/item/pizzabox/boxtotagto = src
if( boxes.len > 0 )
@@ -138,7 +138,7 @@
attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/pen) || istype(W, /obj/item/device/flashlight/pen))
var/tmp_label = sanitize(copytext(input(user, "Enter a label for [src.name]","Label",src.label_text), 1, MAX_NAME_LEN))
var/tmp_label = sanitizeSafe(input(user, "Enter a label for [src.name]","Label",src.label_text), MAX_NAME_LEN)
if(length(tmp_label) > 10)
user << "\red The label can be at most 10 characters long."
else
+4 -4
View File
@@ -43,7 +43,7 @@
else if(istype(W, /obj/item/weapon/pen))
switch(alert("What would you like to alter?",,"Title","Description", "Cancel"))
if("Title")
var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_NAME_LEN)))
var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN)
if(!str || !length(str))
usr << "<span class='warning'> Invalid text.</span>"
return
@@ -57,7 +57,7 @@
else
nameset = 1
if("Description")
var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_MESSAGE_LEN)))
var/str = sanitize(input(usr,"Label text?","Set label",""))
if(!str || !length(str))
usr << "\red Invalid text."
return
@@ -150,7 +150,7 @@
else if(istype(W, /obj/item/weapon/pen))
switch(alert("What would you like to alter?",,"Title","Description", "Cancel"))
if("Title")
var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_NAME_LEN)))
var/str = sanitizeSafe(input(usr,"Label text?","Set label",""), MAX_NAME_LEN)
if(!str || !length(str))
usr << "<span class='warning'> Invalid text.</span>"
return
@@ -165,7 +165,7 @@
nameset = 1
if("Description")
var/str = trim(sanitize(copytext(input(usr,"Label text?","Set label",""),1,MAX_MESSAGE_LEN)))
var/str = sanitize(input(usr,"Label text?","Set label",""))
if(!str || !length(str))
usr << "\red Invalid text."
return
@@ -84,7 +84,7 @@ datum
obj/item/weapon/reagent_containers/glass/solution_tray/attackby(obj/item/weapon/W as obj, mob/living/user as mob)
if(istype(W, /obj/item/weapon/pen))
var/new_label = input("What should the new label be?","Label solution tray")
var/new_label = sanitizeSafe(input("What should the new label be?","Label solution tray"), MAX_NAME_LEN)
if(new_label)
name = "solution tray ([new_label])"
user << "\blue You write on the label of the solution tray."
@@ -79,7 +79,7 @@
else
..()
else if(istype(W,/obj/item/weapon/pen))
plaque_contents = input("What would you like to write on the plaque:","Skeleton plaque","")
plaque_contents = sanitize(input("What would you like to write on the plaque:","Skeleton plaque",""))
user.visible_message("[user] writes something on the base of [src].","You relabel the plaque on the base of \icon[src] [src].")
if(src.contents.Find(/obj/item/weapon/fossil/skull/horned))
src.desc = "A creature made of [src.contents.len-1] assorted bones and a horned skull. The plaque reads \'[plaque_contents]\'."