mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Merge pull request #6984 from tkdrg/sanitaiz
Replaces a bunch of input() with stripped_input()
This commit is contained in:
@@ -149,10 +149,10 @@ var/datum/subsystem/vote/SSvote
|
||||
if("restart") choices.Add("Restart Round","Continue Playing")
|
||||
if("gamemode") choices.Add(config.votable_modes)
|
||||
if("custom")
|
||||
question = html_encode(input(usr,"What is the vote for?") as text|null)
|
||||
question = stripped_input(usr,"What is the vote for?")
|
||||
if(!question) return 0
|
||||
for(var/i=1,i<=10,i++)
|
||||
var/option = capitalize(html_encode(input(usr,"Please enter an option or hit cancel to finish") as text|null))
|
||||
var/option = capitalize(stripped_input(usr,"Please enter an option or hit cancel to finish"))
|
||||
if(!option || mode || !usr.client) break
|
||||
choices.Add(option)
|
||||
else return 0
|
||||
|
||||
@@ -466,7 +466,7 @@ body
|
||||
usr << "This can only be used on instances of type /mob"
|
||||
return
|
||||
|
||||
var/new_name = copytext(sanitize(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null),1,MAX_NAME_LEN)
|
||||
var/new_name = stripped_input(usr,"What would you like to name this mob?","Input a name",M.real_name,MAX_NAME_LEN)
|
||||
if( !new_name || !M ) return
|
||||
|
||||
message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].")
|
||||
|
||||
+1
-1
@@ -634,7 +634,7 @@
|
||||
new_objective.target_amount = target_number
|
||||
|
||||
if ("custom")
|
||||
var/expl = copytext(sanitize(input("Custom objective:", "Objective", objective ? objective.explanation_text : "") as text|null),1,MAX_MESSAGE_LEN)
|
||||
var/expl = stripped_input(usr, "Custom objective:", "Objective", objective ? objective.explanation_text : "")
|
||||
if (!expl) return
|
||||
new_objective = new /datum/objective
|
||||
new_objective.owner = src
|
||||
|
||||
@@ -345,7 +345,7 @@ datum/objective/steal/proc/select_target() //For admins setting objectives manua
|
||||
var/tmp_obj = new custom_target
|
||||
var/custom_name = tmp_obj:name
|
||||
qdel(tmp_obj)
|
||||
custom_name = copytext(sanitize(input("Enter target name:", "Objective target", custom_name) as text|null),1,MAX_MESSAGE_LEN)
|
||||
custom_name = stripped_input("Enter target name:", "Objective target", custom_name)
|
||||
if (!custom_name) return
|
||||
steal_target = custom_target
|
||||
explanation_text = "Steal [custom_name]."
|
||||
|
||||
@@ -75,7 +75,7 @@ datum/airlock_maker/Topic(var/href,var/list/href_list)
|
||||
return
|
||||
|
||||
if("rename" in href_list)
|
||||
var/newname = input(usr,"New airlock name:","Name the airlock",doorname) as null|text
|
||||
var/newname = stripped_input(usr,"New airlock name:","Name the airlock",doorname)
|
||||
if(newname)
|
||||
doorname = newname
|
||||
if("access" in href_list)
|
||||
|
||||
@@ -324,7 +324,7 @@ obj/machinery/bot/mulebot/bot_reset()
|
||||
|
||||
if("setid")
|
||||
refresh=0
|
||||
var/new_id = copytext(sanitize(input("Enter new bot ID", "Mulebot [suffix ? "([suffix])" : ""]", suffix) as text|null),1,MAX_NAME_LEN)
|
||||
var/new_id = stripped_input(usr, "Enter new bot ID", "Mulebot [suffix ? "([suffix])" : ""]", suffix, MAX_NAME_LEN)
|
||||
refresh=1
|
||||
if(new_id)
|
||||
suffix = new_id
|
||||
@@ -333,7 +333,7 @@ obj/machinery/bot/mulebot/bot_reset()
|
||||
|
||||
if("sethome")
|
||||
refresh=0
|
||||
var/new_home = input("Enter new home tag", "Mulebot [suffix ? "([suffix])" : ""]", home_destination) as text|null
|
||||
var/new_home = stripped_input(usr, "Enter new home tag", "Mulebot [suffix ? "([suffix])" : ""]", home_destination)
|
||||
refresh=1
|
||||
if(new_home)
|
||||
home_destination = new_home
|
||||
|
||||
@@ -467,7 +467,7 @@
|
||||
src.active2.fields[text("com_[]", href_list["del_c"])] = "<B>Deleted</B>"
|
||||
|
||||
else if (href_list["search"])
|
||||
var/t1 = input("Search String: (Name, DNA, or ID)", "Med. records", null, null) as text
|
||||
var/t1 = stripped_input(usr, "Search String: (Name, DNA, or ID)", "Med. records")
|
||||
if ((!( t1 ) || usr.stat || !( src.authenticated ) || usr.restrained() || ((!in_range(src, usr)) && (!istype(usr, /mob/living/silicon)))))
|
||||
return
|
||||
src.active1 = null
|
||||
|
||||
@@ -417,7 +417,7 @@
|
||||
|
||||
//Select Your Name
|
||||
if("Sender")
|
||||
customsender = input(usr, "Please enter the sender's name.") as text|null
|
||||
customsender = stripped_input(usr, "Please enter the sender's name.")
|
||||
|
||||
//Select Receiver
|
||||
if("Recepient")
|
||||
@@ -430,12 +430,11 @@
|
||||
|
||||
//Enter custom job
|
||||
if("RecJob")
|
||||
customjob = input(usr, "Please enter the sender's job.") as text|null
|
||||
customjob = stripped_input(usr, "Please enter the sender's job.")
|
||||
|
||||
//Enter message
|
||||
if("Message")
|
||||
custommessage = input(usr, "Please enter your message.") as text|null
|
||||
custommessage = copytext(sanitize(custommessage), 1, MAX_MESSAGE_LEN)
|
||||
custommessage = stripped_input(usr, "Please enter your message.")
|
||||
|
||||
//Send message
|
||||
if("Send")
|
||||
|
||||
@@ -514,7 +514,7 @@ What a mess.*/
|
||||
switch(href_list["field"])
|
||||
if("name")
|
||||
if (istype(active1, /datum/data/record) || istype(active2, /datum/data/record))
|
||||
var/t1 = input("Please input name:", "Secure. records", active1.fields["name"], null) as text
|
||||
var/t1 = stripped_input(usr, "Please input name:", "Secure. records", active1.fields["name"], null)
|
||||
if ((!( t1 ) || !length(trim(t1)) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon)))) || active1 != a1)
|
||||
return
|
||||
if(istype(active1, /datum/data/record))
|
||||
|
||||
@@ -204,12 +204,12 @@ Transponder Codes:<UL>"}
|
||||
else if(href_list["edit"])
|
||||
var/codekey = href_list["code"]
|
||||
|
||||
var/newkey = input("Enter Transponder Code Key", "Navigation Beacon", codekey) as text|null
|
||||
var/newkey = stripped_input(usr, "Enter Transponder Code Key", "Navigation Beacon", codekey)
|
||||
if(!newkey)
|
||||
return
|
||||
|
||||
var/codeval = codes[codekey]
|
||||
var/newval = input("Enter Transponder Code Value", "Navigation Beacon", codeval) as text|null
|
||||
var/newval = stripped_input(usr, "Enter Transponder Code Value", "Navigation Beacon", codeval)
|
||||
if(!newval)
|
||||
newval = codekey
|
||||
return
|
||||
@@ -226,11 +226,11 @@ Transponder Codes:<UL>"}
|
||||
|
||||
else if(href_list["add"])
|
||||
|
||||
var/newkey = input("Enter New Transponder Code Key", "Navigation Beacon") as text|null
|
||||
var/newkey = stripped_input(usr, "Enter New Transponder Code Key", "Navigation Beacon")
|
||||
if(!newkey)
|
||||
return
|
||||
|
||||
var/newval = input("Enter New Transponder Code Value", "Navigation Beacon") as text|null
|
||||
var/newval = stripped_input(usr, "Enter New Transponder Code Value", "Navigation Beacon")
|
||||
if(!newval)
|
||||
newval = "1"
|
||||
return
|
||||
|
||||
@@ -792,8 +792,7 @@
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/weapon/pen)) //you can rename turrets like bots!
|
||||
var/t = input(user, "Enter new turret name", name, finish_name) as text
|
||||
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
|
||||
var/t = stripped_input(user, "Enter new turret name", name, finish_name)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, usr) && loc != usr)
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
|
||||
if(href_list["network"])
|
||||
|
||||
var/newnet = input(usr, "Which network do you want to view?", "Comm Monitor", network) as null|text
|
||||
var/newnet = stripped_input(usr, "Which network do you want to view?", "Comm Monitor", network)
|
||||
|
||||
if(newnet && ((usr in range(1, src) || issilicon(usr))))
|
||||
if(length(newnet) > 15)
|
||||
|
||||
@@ -308,7 +308,7 @@
|
||||
temp = "<font color = #666633>-% New ID assigned: \"[id]\" %-</font color>"
|
||||
|
||||
if("network")
|
||||
var/newnet = input(usr, "Specify the new network for this machine. This will break all current links.", src, network) as null|text
|
||||
var/newnet = stripped_input(usr, "Specify the new network for this machine. This will break all current links.", src, network)
|
||||
if(newnet && canAccess(usr))
|
||||
|
||||
if(length(newnet) > 15)
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
|
||||
if(href_list["network"])
|
||||
|
||||
var/newnet = input(usr, "Which network do you want to view?", "Comm Monitor", network) as null|text
|
||||
var/newnet = stripped_input(usr, "Which network do you want to view?", "Comm Monitor", network)
|
||||
if(newnet && ((usr in range(1, src) || issilicon(usr))))
|
||||
if(length(newnet) > 15)
|
||||
temp = "<font color = #D70B00>- FAILED: NETWORK TAG STRING TOO LENGHTLY -</font color>"
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
|
||||
if(href_list["network"])
|
||||
|
||||
var/newnet = input(usr, "Which network do you want to view?", "Comm Monitor", network) as null|text
|
||||
var/newnet = stripped_input(usr, "Which network do you want to view?", "Comm Monitor", network)
|
||||
|
||||
if(newnet && canAccess(usr))
|
||||
if(length(newnet) > 15)
|
||||
|
||||
@@ -44,12 +44,11 @@
|
||||
|
||||
/obj/structure/closet/body_bag/attackby(obj/item/I, mob/user)
|
||||
if (istype(I, /obj/item/weapon/pen))
|
||||
var/t = input(user, "What would you like the label to be?", name, null) as text
|
||||
var/t = stripped_input(user, "What would you like the label to be?", name, null, 53)
|
||||
if(user.get_active_hand() != I)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
t = copytext(sanitize(t), 1, 53) //max length of 64 - "body bag - " instead of MAX_MESSAGE_LEN, as per the hand labeler
|
||||
if(t)
|
||||
name = "body bag - "
|
||||
name += t
|
||||
|
||||
@@ -631,11 +631,10 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
//CHATROOM FUNCTIONS====================================
|
||||
|
||||
if("Set Nick")
|
||||
var/t = stripped_input(U, "Please enter nickname", name, null) as text
|
||||
nick = copytext(sanitize(t), 1, 9)
|
||||
nick = stripped_input(U, "Please enter nickname", name, null, 8)
|
||||
|
||||
if("Set Channel")
|
||||
var/t = stripped_input(U, "Please enter channel", name, (chat_channel)) as text
|
||||
var/t = stripped_input(U, "Please enter channel", name, chat_channel)
|
||||
|
||||
if(t)
|
||||
var/datum/chatroom/C = chatchannels[chat_channel]
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
/obj/item/weapon/implantcase/attackby(obj/item/weapon/W, mob/user)
|
||||
..()
|
||||
if(istype(W, /obj/item/weapon/pen))
|
||||
var/t = input(user, "What would you like the label to be?", name, null) as text
|
||||
var/t = stripped_input(user, "What would you like the label to be?", name, null)
|
||||
if(user.get_active_hand() != W)
|
||||
return
|
||||
if(!in_range(src, user) && loc != user)
|
||||
return
|
||||
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
|
||||
if(t)
|
||||
name = "glass case- '[t]'"
|
||||
else
|
||||
|
||||
@@ -59,12 +59,11 @@
|
||||
|
||||
/obj/structure/bodycontainer/attackby(P as obj, mob/user as mob)
|
||||
if (istype(P, /obj/item/weapon/pen))
|
||||
var/t = input(user, "What would you like the label to be?", text("[]", name), null) as text
|
||||
var/t = stripped_input(user, "What would you like the label to be?", text("[]", name), null)
|
||||
if (user.get_active_hand() != P)
|
||||
return
|
||||
if ((!in_range(src, usr) && src.loc != user))
|
||||
return
|
||||
t = copytext(sanitize(t),1,MAX_MESSAGE_LEN)
|
||||
if (t)
|
||||
name = text("[]- '[]'", initial(name), t)
|
||||
else
|
||||
|
||||
@@ -228,13 +228,13 @@
|
||||
if(open )
|
||||
return
|
||||
|
||||
var/t = input("Enter what you want to add to the tag:", "Write", null, null) as text
|
||||
var/t = stripped_input(user, "Enter what you want to add to the tag:", "Write", "", 30)
|
||||
|
||||
var/obj/item/pizzabox/boxtotagto = src
|
||||
if(boxes.len > 0)
|
||||
boxtotagto = boxes[boxes.len]
|
||||
|
||||
boxtotagto.boxtag = copytext("[boxtotagto.boxtag][t]", 1, 30)
|
||||
boxtotagto.boxtag = "[boxtotagto.boxtag][t]"
|
||||
|
||||
update_icon()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user