TG: Some fixes for topic calls and inputs.

There's like 1001 things to fix so some of this is somewhat crude for now.

new helper proc located in procs/helpers.dm
reject_bad_text(var/text)
just feed any text in and it will either return the original text or null (if it
contains odd characters such as \ / < > or characters reserved by BYOND. It also
rejects if there are no non-whitespace characters)
Revision: r3571
Author: 	 elly1...@rocketmail.com
This commit is contained in:
Erthilo
2012-05-10 03:02:56 +01:00
parent 3c9b734c2f
commit 8aae642d83
8 changed files with 674 additions and 620 deletions

View File

@@ -226,6 +226,7 @@
if(usr.stat || usr.restrained()) return
if(!in_range(src, usr)) return
src.add_fingerprint(usr)
usr.machine = src
if(!beaker) return
var/datum/reagents/R = beaker:reagents
@@ -290,9 +291,9 @@
reagents.clear_reagents()
icon_state = "mixer0"
else if (href_list["createpill"])
var/name = input(usr,"Name:","Name your pill!",reagents.get_master_reagent_name())
var/name = reject_bad_text(input(usr,"Name:","Name your pill!",reagents.get_master_reagent_name()))
var/obj/item/weapon/reagent_containers/pill/P = new/obj/item/weapon/reagent_containers/pill(src.loc)
if(!name || name == " ") name = reagents.get_master_reagent_name()
if(!name) name = reagents.get_master_reagent_name()
P.name = "[name] pill"
P.pixel_x = rand(-7, 7) //random position
P.pixel_y = rand(-7, 7)
@@ -300,9 +301,9 @@
reagents.trans_to(P,50)
else if (href_list["createbottle"])
if(!condi)
var/name = input(usr,"Name:","Name your bottle!",reagents.get_master_reagent_name())
var/name = reject_bad_text(input(usr,"Name:","Name your bottle!",reagents.get_master_reagent_name()))
var/obj/item/weapon/reagent_containers/glass/bottle/P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc)
if(!name || name == " ") name = reagents.get_master_reagent_name()
if(!name) name = reagents.get_master_reagent_name()
P.name = "[name] bottle"
P.pixel_x = rand(-7, 7) //random position
P.pixel_y = rand(-7, 7)
@@ -334,7 +335,6 @@
else
usr << browse(null, "window=chem_master")
src.updateUsrDialog()
src.add_fingerprint(usr)
return
attack_ai(mob/user as mob)

View File

@@ -621,22 +621,7 @@
if(src:cameraFollow)
src:cameraFollow = null
/client/Topic(href, href_list)
if(href_list["priv_msg"])
var/client/C = locate(href_list["priv_msg"])
if(ismob(C)) //Old stuff can pass in mobs instead of clients
var/mob/M = C
C = M.client
cmd_admin_pm(C,null)
else
..()
/mob/Topic(href, href_list)
if(href_list["priv_msg"]) //for priv_msg references that have yet to be updated to target clients. Forwards it to client/Topic()
if(client)
client.Topic(href, href_list)
if(href_list["mach_close"])
var/t1 = text("window=[href_list["mach_close"]]")
machine = null
@@ -685,7 +670,7 @@
onclose(usr, "[name]")
if(href_list["flavor_change"])
update_flavor_text()
..()
// ..()
return
/mob/proc/get_damage()

View File

@@ -40,7 +40,7 @@
if(mode)
usr << "\blue You turn on the hand labeler."
//Now let them chose the text.
var/str = input(usr,"Label text?","Set label","")
var/str = reject_bad_text(input(usr,"Label text?","Set label","")) //sanitize stuff! GOD DAMN THIS IS A SECURITY HOLE
if(!str || !length(str))
usr << "\red Invalid text."
return