Skip to content

Commit bce0668

Browse files
authored
improves investigate_log (#854)
* improves investigate_log * Update code/game/machinery/computer/security.dm * Update code/game/machinery/computer/security.dm * Update code/game/machinery/computer/security.dm * Update code/game/machinery/computer/security.dm
1 parent 8c8af1c commit bce0668

File tree

2 files changed

+71
-6
lines changed

2 files changed

+71
-6
lines changed

code/game/machinery/computer/security.dm

+63-4
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ What a mess.*/
507507
return
508508
if(!(R.fields["criminal"] == CRIMINAL_WANTED))
509509
return
510+
investigate_log("[key_name(usr)] send a security status broadcast for [R.fields["name"]].", INVESTIGATE_RECORDS)
510511

511512
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_WANTED_CRIMINAL, R)
512513

@@ -670,7 +671,9 @@ Age: [active1.fields["age"]]<BR>"}
670671
var/counter = 1
671672
while(active2.fields["com_[counter]"])
672673
counter++
673-
active2.fields["com_[counter]"] = "Made by [src.authenticated] ([src.rank]) on [stationtime2text()] [time2text(world.realtime, "MMM DD")], [CURRENT_STATION_YEAR]<BR>[t1]"
674+
active2.fields["com_[counter]"] = "Made by [src.authenticated] ([src.rank]) on [stationtime2text()] [stationdate2text()]<BR>[t1]"
675+
676+
investigate_log("[key_name(usr)] created a new comment for [active2.fields["name"]]: [html_encode(t1)].", INVESTIGATE_RECORDS)
674677

675678
if("Delete Record (ALL)")
676679
if(active1)
@@ -687,6 +690,7 @@ Age: [active1.fields["age"]]<BR>"}
687690
if("Delete Entry")
688691
if((istype(active2, /datum/data/record) && active2.fields["com_[href_list["del_c"]]"]))
689692
active2.fields["com_[href_list["del_c"]]"] = "<B>Deleted</B>"
693+
investigate_log("[key_name(usr)] deleted a record entry: [active2.fields["name"]].", INVESTIGATE_RECORDS)
690694
//RECORD CREATE
691695
if("New Record (Security)")
692696
if((istype(active1, /datum/data/record) && !( istype(active2, /datum/data/record) )))
@@ -700,6 +704,7 @@ Age: [active1.fields["age"]]<BR>"}
700704
GLOB.data_core.security += R
701705
active2 = R
702706
screen = 3
707+
investigate_log("[key_name(usr)] created a new security record.", INVESTIGATE_RECORDS)
703708

704709
if("New Record (General)")
705710
//General Record
@@ -746,6 +751,8 @@ Age: [active1.fields["age"]]<BR>"}
746751
M.fields["notes"] = "No notes."
747752
GLOB.data_core.medical += M
748753

754+
investigate_log("[key_name(usr)] created a new record of each type.", INVESTIGATE_RECORDS)
755+
749756

750757

751758
//FIELD FUNCTIONS
@@ -760,54 +767,71 @@ Age: [active1.fields["age"]]<BR>"}
760767
if(!canUseSecurityRecordsConsole(usr, t1, a1))
761768
return
762769
if(istype(active1, /datum/data/record))
770+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: name | Old value:[active1.fields["name"]] | New value: [t1].", INVESTIGATE_RECORDS)
763771
active1.fields["name"] = t1
764772
if(istype(active2, /datum/data/record))
773+
investigate_log("[key_name(usr)] updated [active2.fields["name"]]'s record: Var: name | Old value:[active2.fields["name"]] | New value: [t1].", INVESTIGATE_RECORDS)
765774
active2.fields["name"] = t1
766775
if("id")
767776
if(istype(active2, /datum/data/record) || istype(active1, /datum/data/record))
768777
var/t1 = tgui_input_text(usr, "Input an id", "Security Records", active1.fields["id"])
769778
if(!canUseSecurityRecordsConsole(usr, t1, a1))
770779
return
771780
if(istype(active1, /datum/data/record))
781+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: id | Old value:[active1.fields["id"]] | New value: [t1].", INVESTIGATE_RECORDS)
772782
active1.fields["id"] = t1
773783
if(istype(active2, /datum/data/record))
784+
investigate_log("[key_name(usr)] updated [active2.fields["name"]]'s record: Var: id | Old value:[active2.fields["id"]] | New value: [t1].", INVESTIGATE_RECORDS)
774785
active2.fields["id"] = t1
786+
775787
if("fingerprint")
776788
if(istype(active1, /datum/data/record))
777789
var/t1 = tgui_input_text(usr, "Input a fingerprint hash", "Security Records", active1.fields["fingerprint"])
778790
if(!canUseSecurityRecordsConsole(usr, t1, a1))
779791
return
792+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: fingerprint | Old value:[active1.fields["fingerprint"]] | New value: [t1].", INVESTIGATE_RECORDS)
780793
active1.fields["fingerprint"] = t1
794+
781795
if("gender")
782796
if(istype(active1, /datum/data/record))
797+
var/new_gender
783798
if(active1.fields["gender"] == "Male")
784-
active1.fields["gender"] = "Female"
799+
new_gender = "Female"
785800
else if(active1.fields["gender"] == "Female")
786-
active1.fields["gender"] = "Other"
801+
new_gender = "Other"
787802
else
788-
active1.fields["gender"] = "Male"
803+
new_gender = "Male"
804+
805+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: gender | Old value:[active1.fields["gender"]] | New value: [new_gender].", INVESTIGATE_RECORDS)
806+
active1.fields["gender"] = new_gender
807+
789808
if("age")
790809
if(istype(active1, /datum/data/record))
791810
var/t1 = tgui_input_number(usr, "Input age", "Security records", active1.fields["age"], AGE_MAX, AGE_MIN)
792811
if (!t1)
793812
return
794813
if(!canUseSecurityRecordsConsole(usr, "age", a1))
795814
return
815+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: age | Old value:[active1.fields["age"]] | New value: [t1].", INVESTIGATE_RECORDS)
796816
active1.fields["age"] = t1
817+
797818
if("species")
798819
if(istype(active1, /datum/data/record))
799820
var/t1 = tgui_input_list(usr, "Select a species", "Species Selection", get_selectable_species())
800821
if(isnull(t1))
801822
return
802823
if(!canUseSecurityRecordsConsole(usr, t1, a1))
803824
return
825+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: species | Old value:[active1.fields["species"]] | New value: [t1].", INVESTIGATE_RECORDS)
804826
active1.fields["species"] = t1
827+
805828
if("show_photo_front")
806829
if(active1)
807830
var/front_photo = active1.get_front_photo()
808831
if(istype(front_photo, /obj/item/photo))
809832
var/obj/item/photo/photo = front_photo
810833
photo.show(usr)
834+
811835
if("upd_photo_front")
812836
var/obj/item/photo/photo = get_photo(usr)
813837
if(photo)
@@ -820,18 +844,22 @@ Age: [active1.fields["age"]]<BR>"}
820844
var/dh = w - 32
821845
I.Crop(dw/2, dh/2, w - dw/2, h - dh/2)
822846
active1.fields["photo_front"] = photo
847+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s front photo.", INVESTIGATE_RECORDS)
848+
823849
if("print_photo_front")
824850
if(active1)
825851
var/front_photo = active1.get_front_photo()
826852
if(istype(front_photo, /obj/item/photo))
827853
var/obj/item/photo/photo_front = front_photo
828854
print_photo(photo_front.picture.picture_image, active1.fields["name"])
855+
829856
if("show_photo_side")
830857
if(active1)
831858
var/side_photo = active1.get_side_photo()
832859
if(istype(side_photo, /obj/item/photo))
833860
var/obj/item/photo/photo = side_photo
834861
photo.show(usr)
862+
835863
if("upd_photo_side")
836864
var/obj/item/photo/photo = get_photo(usr)
837865
if(photo)
@@ -844,12 +872,15 @@ Age: [active1.fields["age"]]<BR>"}
844872
var/dh = w - 32
845873
I.Crop(dw/2, dh/2, w - dw/2, h - dh/2)
846874
active1.fields["photo_side"] = photo
875+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s front photo.", INVESTIGATE_RECORDS)
876+
847877
if("print_photo_side")
848878
if(active1)
849879
var/side_photo = active1.get_side_photo()
850880
if(istype(side_photo, /obj/item/photo))
851881
var/obj/item/photo/photo_side = side_photo
852882
print_photo(photo_side.picture.picture_image, active1.fields["name"])
883+
853884
if("crim_add")
854885
if(istype(active1, /datum/data/record))
855886
var/t1 = tgui_input_text(usr, "Input crime names", "Security Records")
@@ -859,12 +890,24 @@ Age: [active1.fields["age"]]<BR>"}
859890
var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, stationtime2text())
860891
GLOB.data_core.addCrime(active1.fields["id"], crime)
861892
investigate_log("New Crime: <strong>[t1]</strong>: [t2] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
893+
862894
if("crim_delete")
863895
if(istype(active1, /datum/data/record))
864896
if(href_list["cdataid"])
865897
if(!canUseSecurityRecordsConsole(usr, "delete", null, a2))
866898
return
899+
var/crime_name = ""
900+
var/crime_details = ""
901+
var/list/crimes = active1.fields["citation"]
902+
for(var/datum/data/crime/crime in crimes)
903+
if(crime.dataId == text2num(href_list["cdataid"]))
904+
crime_name = crime.crimeName
905+
crime_details = crime.crimeDetails
906+
break
907+
908+
investigate_log("[key_name(usr)] deleted a crime from [active1.fields["name"]]: ([crime_name]) | Details: [crime_details]", INVESTIGATE_RECORDS)
867909
GLOB.data_core.removeCrime(active1.fields["id"],href_list["cdataid"])
910+
868911
if("add_details")
869912
if(istype(active1, /datum/data/record))
870913
if(href_list["cdataid"])
@@ -873,6 +916,7 @@ Age: [active1.fields["age"]]<BR>"}
873916
return
874917
GLOB.data_core.addCrimeDetails(active1.fields["id"], href_list["cdataid"], t1)
875918
investigate_log("New Crime details: [t1] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
919+
876920
if("citation_add")
877921
if(istype(active1, /datum/data/record))
878922
var/maxFine = CONFIG_GET(number/maxfine)
@@ -890,18 +934,31 @@ Age: [active1.fields["age"]]<BR>"}
890934
GLOB.data_core.addCitation(active1.fields["id"], crime)
891935
investigate_log("New Citation: <strong>[t1]</strong> Fine: [fine] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
892936
SSblackbox.ReportCitation(crime.dataId, usr.ckey, usr.real_name, active1.fields["name"], t1, fine)
937+
893938
if("citation_delete")
894939
if(istype(active1, /datum/data/record))
895940
if(href_list["cdataid"])
896941
if(!canUseSecurityRecordsConsole(usr, "delete", null, a2))
897942
return
943+
var/crime_name = ""
944+
var/crime_details = ""
945+
var/list/crimes = active1.fields["citation"]
946+
for(var/datum/data/crime/crime in crimes)
947+
if(crime.dataId == text2num(href_list["cdataid"]))
948+
crime_name = crime.crimeName
949+
crime_details = crime.crimeDetails
950+
break
951+
952+
investigate_log("[key_name(usr)] deleted a citation from [active1.fields["name"]]: ([crime_name]) | Details: [crime_details]", INVESTIGATE_RECORDS)
898953
GLOB.data_core.removeCitation(active1.fields["id"], href_list["cdataid"])
899954
if("notes")
900955
if(istype(active2, /datum/data/record))
901956
var/t1 = tgui_input_text(usr, "Please summarize notes", "Security Records", active2.fields["notes"])
902957
if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
903958
return
959+
investigate_log("[key_name(usr)] updated [active2.fields["name"]]'s notes to: [t1]", INVESTIGATE_RECORDS)
904960
active2.fields["notes"] = t1
961+
905962
if("criminal")
906963
if(istype(active2, /datum/data/record))
907964
temp = "<h5>Criminal Status:</h5>"
@@ -942,8 +999,10 @@ Age: [active1.fields["age"]]<BR>"}
942999
if(ispath(path))
9431000
var/rank = SSid_access.station_job_templates[path]
9441001
if(rank)
1002+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: rank | Old value:[active1.fields["rank"]] | New value: [rank].", INVESTIGATE_RECORDS)
9451003
active1.fields["rank"] = rank
9461004
active1.fields["trim"] = active1.fields["rank"]
1005+
9471006
else
9481007
message_admins("Warning: possible href exploit by [key_name(usr)] - attempted to set change a crew member rank to an invalid path: [path]")
9491008
log_game("Warning: possible href exploit by [key_name(usr)] - attempted to set change a crew member rank to an invalid path: [path]")

code/modules/admin/admin_investigate.dm

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
/atom/proc/investigate_log(message, subject)
22
if(!message || !subject)
33
return
4-
var/F = file("[GLOB.log_directory]/[subject].html")
5-
WRITE_FILE(F, "[time_stamp()] [REF(src)] ([x],[y],[z]) || [src] [message]<br>")
4+
5+
var/source = "[src]"
6+
7+
if(isliving(src))
8+
var/mob/living/source_mob = src
9+
source += " ([source_mob.ckey ? source_mob.ckey : "*no key*"])"
10+
11+
rustg_file_append("[time_stamp("YYYY-MM-DD hh:mm:ss")] [REF(src)] ([x],[y],[z]) || [source] [message]<br>", "[GLOB.log_directory]/[subject].html")
612

713
/client/proc/investigate_show()
814
set name = "Investigate"

0 commit comments

Comments
 (0)