Skip to content

Commit 297b550

Browse files
committed
improves investigate_log
1 parent 23a1ed9 commit 297b550

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()], [CURRENT_STATION_YEAR]<BR>[t1]"
675+
676+
investigate_log("[key_name(usr)] created a new comment for [active2.fields["name"]]: [html_encode(t1)].")
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.")
703708

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

756+
investigate_log("[key_name(usr)] created a new record of each type.")
757+
751758

752759

753760
//FIELD FUNCTIONS
@@ -762,54 +769,71 @@ Age: [active1.fields["age"]]<BR>"}
762769
if(!canUseSecurityRecordsConsole(usr, t1, a1))
763770
return
764771
if(istype(active1, /datum/data/record))
772+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: name | Old value:[active1.fields["name"]] | New value: [t1].", INVESTIGATE_RECORDS)
765773
active1.fields["name"] = t1
766774
if(istype(active2, /datum/data/record))
775+
investigate_log("[key_name(usr)] updated [active2.fields["name"]]'s record: Var: name | Old value:[active2.fields["name"]] | New value: [t1].", INVESTIGATE_RECORDS)
767776
active2.fields["name"] = t1
768777
if("id")
769778
if(istype(active2, /datum/data/record) || istype(active1, /datum/data/record))
770779
var/t1 = tgui_input_text(usr, "Input an id", "Security Records", active1.fields["id"])
771780
if(!canUseSecurityRecordsConsole(usr, t1, a1))
772781
return
773782
if(istype(active1, /datum/data/record))
783+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: id | Old value:[active1.fields["id"]] | New value: [t1].", INVESTIGATE_RECORDS)
774784
active1.fields["id"] = t1
775785
if(istype(active2, /datum/data/record))
786+
investigate_log("[key_name(usr)] updated [active2.fields["name"]]'s record: Var: id | Old value:[active2.fields["id"]] | New value: [t1].", INVESTIGATE_RECORDS)
776787
active2.fields["id"] = t1
788+
777789
if("fingerprint")
778790
if(istype(active1, /datum/data/record))
779791
var/t1 = tgui_input_text(usr, "Input a fingerprint hash", "Security Records", active1.fields["fingerprint"])
780792
if(!canUseSecurityRecordsConsole(usr, t1, a1))
781793
return
794+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: fingerprint | Old value:[active1.fields["fingerprint"]] | New value: [t1].", INVESTIGATE_RECORDS)
782795
active1.fields["fingerprint"] = t1
796+
783797
if("gender")
784798
if(istype(active1, /datum/data/record))
799+
var/new_gender
785800
if(active1.fields["gender"] == "Male")
786-
active1.fields["gender"] = "Female"
801+
new_gender = "Female"
787802
else if(active1.fields["gender"] == "Female")
788-
active1.fields["gender"] = "Other"
803+
new_gender = "Other"
789804
else
790-
active1.fields["gender"] = "Male"
805+
new_gender = "Male"
806+
807+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: gender | Old value:[active1.fields["gender"]] | New value: [new_gender].", INVESTIGATE_RECORDS)
808+
active1.fields["gender"] = new_gender
809+
791810
if("age")
792811
if(istype(active1, /datum/data/record))
793812
var/t1 = tgui_input_number(usr, "Input age", "Security records", active1.fields["age"], AGE_MAX, AGE_MIN)
794813
if (!t1)
795814
return
796815
if(!canUseSecurityRecordsConsole(usr, "age", a1))
797816
return
817+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: age | Old value:[active1.fields["age"]] | New value: [t1].", INVESTIGATE_RECORDS)
798818
active1.fields["age"] = t1
819+
799820
if("species")
800821
if(istype(active1, /datum/data/record))
801822
var/t1 = tgui_input_list(usr, "Select a species", "Species Selection", get_selectable_species())
802823
if(isnull(t1))
803824
return
804825
if(!canUseSecurityRecordsConsole(usr, t1, a1))
805826
return
827+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: species | Old value:[active1.fields["species"]] | New value: [t1].", INVESTIGATE_RECORDS)
806828
active1.fields["species"] = t1
829+
807830
if("show_photo_front")
808831
if(active1)
809832
var/front_photo = active1.get_front_photo()
810833
if(istype(front_photo, /obj/item/photo))
811834
var/obj/item/photo/photo = front_photo
812835
photo.show(usr)
836+
813837
if("upd_photo_front")
814838
var/obj/item/photo/photo = get_photo(usr)
815839
if(photo)
@@ -822,18 +846,22 @@ Age: [active1.fields["age"]]<BR>"}
822846
var/dh = w - 32
823847
I.Crop(dw/2, dh/2, w - dw/2, h - dh/2)
824848
active1.fields["photo_front"] = photo
849+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s front photo.", INVESTIGATE_RECORDS)
850+
825851
if("print_photo_front")
826852
if(active1)
827853
var/front_photo = active1.get_front_photo()
828854
if(istype(front_photo, /obj/item/photo))
829855
var/obj/item/photo/photo_front = front_photo
830856
print_photo(photo_front.picture.picture_image, active1.fields["name"])
857+
831858
if("show_photo_side")
832859
if(active1)
833860
var/side_photo = active1.get_side_photo()
834861
if(istype(side_photo, /obj/item/photo))
835862
var/obj/item/photo/photo = side_photo
836863
photo.show(usr)
864+
837865
if("upd_photo_side")
838866
var/obj/item/photo/photo = get_photo(usr)
839867
if(photo)
@@ -846,12 +874,15 @@ Age: [active1.fields["age"]]<BR>"}
846874
var/dh = w - 32
847875
I.Crop(dw/2, dh/2, w - dw/2, h - dh/2)
848876
active1.fields["photo_side"] = photo
877+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s front photo.", INVESTIGATE_RECORDS)
878+
849879
if("print_photo_side")
850880
if(active1)
851881
var/side_photo = active1.get_side_photo()
852882
if(istype(side_photo, /obj/item/photo))
853883
var/obj/item/photo/photo_side = side_photo
854884
print_photo(photo_side.picture.picture_image, active1.fields["name"])
885+
855886
if("crim_add")
856887
if(istype(active1, /datum/data/record))
857888
var/t1 = tgui_input_text(usr, "Input crime names", "Security Records")
@@ -861,12 +892,24 @@ Age: [active1.fields["age"]]<BR>"}
861892
var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, stationtime2text())
862893
GLOB.data_core.addCrime(active1.fields["id"], crime)
863894
investigate_log("New Crime: <strong>[t1]</strong>: [t2] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
895+
864896
if("crim_delete")
865897
if(istype(active1, /datum/data/record))
866898
if(href_list["cdataid"])
867899
if(!canUseSecurityRecordsConsole(usr, "delete", null, a2))
868900
return
901+
var/crime_name = ""
902+
var/crime_details = ""
903+
var/list/crimes = active1.fields["citation"]
904+
for(var/datum/data/crime/crime in crimes)
905+
if(crime.dataId == text2num(href_list["cdataid"]))
906+
crime_name = crime.crimeName
907+
crime_details = crime.crimeDetails
908+
break
909+
910+
investigate_log("[key_name(usr)] deleted a crime from [active1.fields["name"]]: ([crime_name]) | Details: [crime_details]", INVESTIGATE_RECORDS)
869911
GLOB.data_core.removeCrime(active1.fields["id"],href_list["cdataid"])
912+
870913
if("add_details")
871914
if(istype(active1, /datum/data/record))
872915
if(href_list["cdataid"])
@@ -875,6 +918,7 @@ Age: [active1.fields["age"]]<BR>"}
875918
return
876919
GLOB.data_core.addCrimeDetails(active1.fields["id"], href_list["cdataid"], t1)
877920
investigate_log("New Crime details: [t1] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
921+
878922
if("citation_add")
879923
if(istype(active1, /datum/data/record))
880924
var/maxFine = CONFIG_GET(number/maxfine)
@@ -892,18 +936,31 @@ Age: [active1.fields["age"]]<BR>"}
892936
GLOB.data_core.addCitation(active1.fields["id"], crime)
893937
investigate_log("New Citation: <strong>[t1]</strong> Fine: [fine] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
894938
SSblackbox.ReportCitation(crime.dataId, usr.ckey, usr.real_name, active1.fields["name"], t1, fine)
939+
895940
if("citation_delete")
896941
if(istype(active1, /datum/data/record))
897942
if(href_list["cdataid"])
898943
if(!canUseSecurityRecordsConsole(usr, "delete", null, a2))
899944
return
945+
var/crime_name = ""
946+
var/crime_details = ""
947+
var/list/crimes = active1.fields["citation"]
948+
for(var/datum/data/crime/crime in crimes)
949+
if(crime.dataId == text2num(href_list["cdataid"]))
950+
crime_name = crime.crimeName
951+
crime_details = crime.crimeDetails
952+
break
953+
954+
investigate_log("[key_name(usr)] deleted a citation from [active1.fields["name"]]: ([crime_name]) | Details: [crime_details]", INVESTIGATE_RECORDS)
900955
GLOB.data_core.removeCitation(active1.fields["id"], href_list["cdataid"])
901956
if("notes")
902957
if(istype(active2, /datum/data/record))
903958
var/t1 = tgui_input_text(usr, "Please summarize notes", "Security Records", active2.fields["notes"])
904959
if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
905960
return
961+
investigate_log("[key_name(usr)] updated [active2.fields["name"]]'s notes to: [t1]", INVESTIGATE_RECORDS)
906962
active2.fields["notes"] = t1
963+
907964
if("criminal")
908965
if(istype(active2, /datum/data/record))
909966
temp = "<h5>Criminal Status:</h5>"
@@ -944,8 +1001,10 @@ Age: [active1.fields["age"]]<BR>"}
9441001
if(ispath(path))
9451002
var/rank = SSid_access.station_job_templates[path]
9461003
if(rank)
1004+
investigate_log("[key_name(usr)] updated [active1.fields["name"]]'s record: Var: rank | Old value:[active1.fields["rank"]] | New value: [rank].", INVESTIGATE_RECORDS)
9471005
active1.fields["rank"] = rank
9481006
active1.fields["trim"] = active1.fields["rank"]
1007+
9491008
else
9501009
message_admins("Warning: possible href exploit by [key_name(usr)] - attempted to set change a crew member rank to an invalid path: [path]")
9511010
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)