From 3787aa4072a4ba8a333b112093efefc526659b57 Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sat, 2 Jun 2012 22:50:31 +0100 Subject: [PATCH 1/3] Missed some \The checks. --- code/game/machinery/cell_charger.dm | 2 +- code/game/machinery/recharger.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 73d96e870e7..d69651546d6 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -50,7 +50,7 @@ if(!isarea(a)) return if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power! - user << "\red The [src] blinks red as you try to insert the cell!" + user << "\red \The [src] blinks red as you try to insert the cell!" return user.drop_item() diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index c38f366a116..6b1705eec2a 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -29,7 +29,7 @@ obj/machinery/recharger if(!isarea(a)) return if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power! - user << "\red The [name] blinks red as you try to insert the item!" + user << "\red \The [src] blinks red as you try to insert the item!" return user.drop_item() G.loc = src From 218bf6643ca5fb3c1ec48e7a5400aacb2c261b55 Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sat, 2 Jun 2012 22:53:19 +0100 Subject: [PATCH 2/3] Shortened MAX_NAME_LEN to 32. Change some MAX_MESSAGE_LEN's to MAX_NAME_LEN's --- code/defines/global.dm | 2 +- code/game/machinery/bots/cleanbot.dm | 2 +- code/game/machinery/bots/ed209bot.dm | 2 +- code/game/machinery/bots/floorbot.dm | 4 ++-- code/game/machinery/bots/medbot.dm | 2 +- code/game/machinery/bots/secbot.dm | 2 +- code/game/machinery/computer/card.dm | 2 +- code/game/machinery/portable_turret.dm | 2 +- code/game/magic/library.dm | 2 +- code/game/objects/bodybag.dm | 2 +- code/modules/recycling/sortingmachinery.dm | 4 ++-- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/code/defines/global.dm b/code/defines/global.dm index 8a277246855..2a07025e951 100644 --- a/code/defines/global.dm +++ b/code/defines/global.dm @@ -189,7 +189,7 @@ var/const/MAX_MESSAGE_LEN = 1024 var/const/MAX_PAPER_MESSAGE_LEN = 3072 var/const/MAX_BOOK_MESSAGE_LEN = 9216 -var/const/MAX_NAME_LEN = 40 +var/const/MAX_NAME_LEN = 32 var/list/paper_blacklist = list("script","frame","iframe","input","button","a","embed","object") diff --git a/code/game/machinery/bots/cleanbot.dm b/code/game/machinery/bots/cleanbot.dm index 3b24ee2b277..91ef3de010f 100644 --- a/code/game/machinery/bots/cleanbot.dm +++ b/code/game/machinery/bots/cleanbot.dm @@ -371,7 +371,7 @@ text("[src.oddbutton ? "Yes" : "No" else if (istype(W, /obj/item/weapon/pen)) var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + t = copytext(sanitize(t), 1, 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 ebd3c081fbc..92cc9281ef9 100644 --- a/code/game/machinery/bots/ed209bot.dm +++ b/code/game/machinery/bots/ed209bot.dm @@ -869,7 +869,7 @@ Auto Patrol: []"}, else if(istype(W, /obj/item/weapon/pen)) var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + t = copytext(sanitize(t), 1, MAX_NAME_LEN) if (!t) return if (!in_range(src, usr) && src.loc != usr) diff --git a/code/game/machinery/bots/floorbot.dm b/code/game/machinery/bots/floorbot.dm index 44cfca6938a..ad4ee1528c1 100644 --- a/code/game/machinery/bots/floorbot.dm +++ b/code/game/machinery/bots/floorbot.dm @@ -400,7 +400,7 @@ del(src) else if (istype(W, /obj/item/weapon/pen)) var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + t = copytext(sanitize(t), 1, MAX_NAME_LEN) if (!t) return if (!in_range(src, usr) && src.loc != usr) @@ -422,7 +422,7 @@ del(src) else if (istype(W, /obj/item/weapon/pen)) var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + t = copytext(sanitize(t), 1, MAX_NAME_LEN) if (!t) return if (!in_range(src, usr) && src.loc != usr) diff --git a/code/game/machinery/bots/medbot.dm b/code/game/machinery/bots/medbot.dm index a0cdfb5be6b..cc149ad015b 100644 --- a/code/game/machinery/bots/medbot.dm +++ b/code/game/machinery/bots/medbot.dm @@ -575,7 +575,7 @@ else if(istype(W, /obj/item/weapon/pen)) var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + t = copytext(sanitize(t), 1, 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 0beff7136cc..46905532dbf 100644 --- a/code/game/machinery/bots/secbot.dm +++ b/code/game/machinery/bots/secbot.dm @@ -761,7 +761,7 @@ Auto Patrol: []"}, else if(istype(W, /obj/item/weapon/pen)) var/t = input(user, "Enter new robot name", src.name, src.created_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + t = copytext(sanitize(t), 1, MAX_NAME_LEN) if(!t) return if(!in_range(src, usr) && src.loc != usr) diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm index bb55e8f65f4..a04c9c2b188 100644 --- a/code/game/machinery/computer/card.dm +++ b/code/game/machinery/computer/card.dm @@ -246,7 +246,7 @@ if (authenticated) var/t1 = href_list["assign_target"] if(t1 == "Custom") - var/temp_t = copytext(sanitize(input("Enter a custom job assignment.","Assignment")),1,MAX_MESSAGE_LEN) + var/temp_t = copytext(sanitize(input("Enter a custom job assignment.","Assignment")),1,MAX_NAME_LEN) if(temp_t) t1 = temp_t else diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 3310a68b6f2..2df8cb6f5c8 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -732,7 +732,7 @@ Neutralize All Unidentified Life Signs: []
"}, if (istype(W, /obj/item/weapon/pen)) // you can rename turrets like bots! var/t = input(user, "Enter new turret name", src.name, src.finish_name) as text - t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN) + t = copytext(sanitize(t), 1, MAX_NAME_LEN) if (!t) return if (!in_range(src, usr) && src.loc != usr) diff --git a/code/game/magic/library.dm b/code/game/magic/library.dm index dee387c3a85..963a7eb16ac 100644 --- a/code/game/magic/library.dm +++ b/code/game/magic/library.dm @@ -126,7 +126,7 @@ O.loc = src update_icon() else if(istype(O, /obj/item/weapon/pen)) - var/newname = copytext(sanitize(input("What would you like to title this bookshelf?") as text|null),1,MAX_MESSAGE_LEN) + var/newname = copytext(sanitize(input("What would you like to title this bookshelf?") as text|null),1,MAX_NAME_LEN) if(!newname) return else diff --git a/code/game/objects/bodybag.dm b/code/game/objects/bodybag.dm index 55a56cd4fb0..cb8a2f6a088 100644 --- a/code/game/objects/bodybag.dm +++ b/code/game/objects/bodybag.dm @@ -48,7 +48,7 @@ return if (!in_range(src, user) && src.loc != user) return - t = copytext(sanitize(t),1,MAX_MESSAGE_LEN) + t = copytext(sanitize(t),1,MAX_NAME_LEN) if (t) src.name = "body bag - " src.name += t diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index b315578d2d0..2f31f953c12 100755 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -62,7 +62,7 @@ name = "[name] ([str])" update_icon() if("Description") - var/str = copytext(sanitize(input(usr,"Label text?","Set label","")),1,MAX_NAME_LEN) + var/str = copytext(sanitize(input(usr,"Label text?","Set label","")),1,MAX_MESSAGE_LEN) if(!str || !length(str)) usr << "\red Invalid text." return @@ -150,7 +150,7 @@ name = "[name] ([str])" update_icon() if("Description") - var/str = copytext(sanitize(input(usr,"Label text?","Set label","")),1,MAX_NAME_LEN) + var/str = copytext(sanitize(input(usr,"Label text?","Set label","")),1,MAX_MESSAGE_LEN) if(!str || !length(str)) usr << "\red Invalid text." return From 30e3132762ea209522316799d4d4f1a486494adc Mon Sep 17 00:00:00 2001 From: Erthilo Date: Sat, 2 Jun 2012 23:32:23 +0100 Subject: [PATCH 3/3] Change flavortext/records inputs so that they format corrently with new lines. They won't show up well on the actual computers, but if you click on them they will. --- code/game/machinery/computer/medical.dm | 4 +++- code/game/machinery/computer/security.dm | 4 +++- code/modules/mob/new_player/preferences.dm | 11 +++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/code/game/machinery/computer/medical.dm b/code/game/machinery/computer/medical.dm index 6c16a433ce1..c377c6d8de7 100644 --- a/code/game/machinery/computer/medical.dm +++ b/code/game/machinery/computer/medical.dm @@ -360,9 +360,11 @@ src.active2.fields["cdi_d"] = t1 if("notes") if (istype(src.active2, /datum/data/record)) - var/t1 = copytext(sanitize(input("Please summarize notes:", "Med. records", src.active2.fields["notes"], null) as message),1,MAX_MESSAGE_LEN) + var/t1 = input("Please summarize notes:", "Med. records", src.active2.fields["notes"], null) as message if ((!( t1 ) || !( src.authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || src.active2 != a2)) return + t1 = copytext(t1, 1, MAX_PAPER_MESSAGE_LEN) + t1 = html_encode(t1) src.active2.fields["notes"] = t1 if("p_stat") if (istype(src.active1, /datum/data/record)) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index aee7d030098..6d06e4af8ba 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -464,9 +464,11 @@ What a mess.*/ active2.fields["ma_crim_d"] = t1 if("notes") if (istype(active2, /datum/data/record)) - var/t1 = copytext(sanitize(input("Please summarize notes:", "Secure. records", active2.fields["notes"], null) as message),1,MAX_MESSAGE_LEN) + var/t1 = input("Please summarize notes:", "Secure. records", active2.fields["notes"], null) as message if ((!( t1 ) || !( authenticated ) || usr.stat || usr.restrained() || (!in_range(src, usr) && (!istype(usr, /mob/living/silicon))) || active2 != a2)) return + t1 = copytext(t1, 1, MAX_PAPER_MESSAGE_LEN) + t1 = html_encode(t1) active2.fields["notes"] = t1 if("criminal") if (istype(active2, /datum/data/record)) diff --git a/code/modules/mob/new_player/preferences.dm b/code/modules/mob/new_player/preferences.dm index 06267f4cbbe..dc7fbfbc983 100644 --- a/code/modules/mob/new_player/preferences.dm +++ b/code/modules/mob/new_player/preferences.dm @@ -707,7 +707,7 @@ datum/preferences if(link_tags["OOC"]) var/tempnote = "" - tempnote = copytext(sanitize(input(user, "Please enter your OOC Notes!:", "OOC notes" , metadata) as text),1,1000) + tempnote = copytext(sanitize(input(user, "Please enter your OOC Notes!:", "OOC notes" , metadata) as text),1,MAX_MESSAGE_LEN) if(tempnote) metadata = tempnote return @@ -924,9 +924,10 @@ datum/preferences be_random_name = !be_random_name if(link_tags["flavor_text"]) - var/msg = copytext(sanitize(input(usr,"Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!","Flavor Text",html_decode(flavor_text)) as message),1,1000) + var/msg = input(usr,"Set the flavor text in your 'examine' verb. This can also be used for OOC notes and preferences!","Flavor Text",html_decode(flavor_text)) as message if(msg != null) + msg = copytext(msg, 1, MAX_MESSAGE_LEN) msg = html_encode(msg) flavor_text = msg @@ -1035,18 +1036,20 @@ datum/preferences user << browse(null, "window=records") if(link_tags["med_record"]) - var/medmsg = copytext(sanitize(input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message),1,2000) + var/medmsg = input(usr,"Set your medical notes here.","Medical Records",html_decode(med_record)) as message if(medmsg != null) + medmsg = copytext(medmsg, 1, MAX_PAPER_MESSAGE_LEN) medmsg = html_encode(medmsg) med_record = medmsg SetRecords(user) if(link_tags["sec_record"]) - var/secmsg = copytext(sanitize(input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message),1,2000) + var/secmsg = input(usr,"Set your security notes here.","Security Records",html_decode(sec_record)) as message if(secmsg != null) + secmsg = copytext(secmsg, 1, MAX_PAPER_MESSAGE_LEN) secmsg = html_encode(secmsg) sec_record = secmsg