diff --git a/SQL/mentor.sql b/SQL/mentor.sql index c5fb7f0d83..45d0829d88 100644 --- a/SQL/mentor.sql +++ b/SQL/mentor.sql @@ -5,10 +5,10 @@ CREATE TABLE `mentor_memo` ( `last_editor` varchar(32) DEFAULT NULL, `edits` text, PRIMARY KEY (`ckey`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; CREATE TABLE `mentor` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ckey` varchar(32) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; diff --git a/SQL/mentor_prefixed.sql b/SQL/mentor_prefixed.sql new file mode 100644 index 0000000000..81e76f333e --- /dev/null +++ b/SQL/mentor_prefixed.sql @@ -0,0 +1,14 @@ +CREATE TABLE `SS13_mentor_memo` ( + `ckey` varchar(32) NOT NULL, + `memotext` text NOT NULL, + `timestamp` datetime NOT NULL, + `last_editor` varchar(32) DEFAULT NULL, + `edits` text, + PRIMARY KEY (`ckey`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +CREATE TABLE `SS13_mentor` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ckey` varchar(32) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 18d880aa48..a4f4f82d92 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2778,10 +2778,17 @@ if(query_get_mentor.NextRow()) to_chat(usr, "[ckey] is already a mentor.") return - var/datum/db_query/query_add_mentor = SSdbcore.NewQuery("INSERT INTO `[format_table_name("mentor")]` (`id`, `ckey`) VALUES (null, '[ckey]')") + var/datum/db_query/query_add_mentor = SSdbcore.NewQuery( + "INSERT INTO [format_table_name("mentor")] (id, ckey) VALUES (:id, :ckey)", + list("id" = null, "ckey" = ckey) + ) if(!query_add_mentor.warn_execute()) return - var/datum/db_query/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new mentor [ckey]');") + var/datum/db_query/query_add_admin_log = SSdbcore.NewQuery({" + INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log) + VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'add mentor', :mentor_ckey, CONCAT('Admin removed: ', :mentor_ckey)) + "}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "mentor_ckey" = ckey) + ) if(!query_add_admin_log.warn_execute()) return else diff --git a/modular_citadel/code/modules/mentor/mentor_memo.dm b/modular_citadel/code/modules/mentor/mentor_memo.dm index 59ea92febd..c64101c30e 100644 --- a/modular_citadel/code/modules/mentor/mentor_memo.dm +++ b/modular_citadel/code/modules/mentor/mentor_memo.dm @@ -94,7 +94,7 @@ var/datum/db_query/update_query = SSdbcore.NewQuery({" UPDATE [format_table_name("mentor_memo")] SET memotext = :new_memo, last_editor = :ckey, edits = :edit_text WHERE ckey = :target_ckey - "}, list("new_memo" = new_memo, "ckey" = ckey, "edit_text" = (edit_text ? "" : edit_text), "target_ckey" = target_ckey)) + "}, list("new_memo" = new_memo, "ckey" = ckey, "edit_text" = (edit_text || ""), "target_ckey" = target_ckey)) if(!update_query.Execute()) var/err = update_query.ErrorMsg() qdel(update_query)