diff --git a/code/modules/mob/dead/new_player/poll.dm b/code/modules/mob/dead/new_player/poll.dm
index 9d0001604c..5b6688a655 100644
--- a/code/modules/mob/dead/new_player/poll.dm
+++ b/code/modules/mob/dead/new_player/poll.dm
@@ -4,9 +4,13 @@
/mob/dead/new_player/proc/handle_player_polling()
if(!SSdbcore.IsConnected())
- to_chat(usr, "Failed to establish database connection.")
+ to_chat(usr, "Failed to establish database connection.", confidential = TRUE)
return
- var/datum/db_query/query_poll_get = SSdbcore.NewQuery("SELECT id, question FROM [format_table_name("poll_question")] WHERE Now() BETWEEN starttime AND endtime [(client.holder ? "" : "AND adminonly = false")]")
+ var/datum/db_query/query_poll_get = SSdbcore.NewQuery({"
+ SELECT id, question
+ FROM [format_table_name("poll_question")]
+ WHERE Now() BETWEEN starttime AND endtime [(client.holder ? "" : "AND adminonly = false")]
+ "})
if(!query_poll_get.warn_execute())
qdel(query_poll_get)
return
@@ -27,9 +31,15 @@
if(!pollid)
return
if (!SSdbcore.Connect())
- to_chat(usr, "Failed to establish database connection.")
+ to_chat(usr, "Failed to establish database connection.", confidential = TRUE)
return
- var/datum/db_query/query_poll_get_details = SSdbcore.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid]")
+ var/datum/db_query/query_poll_get_details = SSdbcore.NewQuery({"
+ SELECT starttime, endtime, question, polltype, multiplechoiceoptions
+ FROM [format_table_name("poll_question")]
+ WHERE id = :id
+ "}, list(
+ "id" = pollid
+ ))
if(!query_poll_get_details.warn_execute())
qdel(query_poll_get_details)
return
@@ -47,7 +57,14 @@
qdel(query_poll_get_details)
switch(polltype)
if(POLLTYPE_OPTION)
- var/datum/db_query/query_option_get_votes = SSdbcore.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
+ var/datum/db_query/query_option_get_votes = SSdbcore.NewQuery({"
+ SELECT optionid
+ FROM [format_table_name("poll_vote")]
+ WHERE pollid = :id AND ckey = :ckey
+ "}, list(
+ "id" = pollid,
+ "ckey" = ckey
+ ))
if(!query_option_get_votes.warn_execute())
qdel(query_option_get_votes)
return
@@ -56,7 +73,13 @@
votedoptionid = text2num(query_option_get_votes.item[1])
qdel(query_option_get_votes)
var/list/datum/polloption/options = list()
- var/datum/db_query/query_option_options = SSdbcore.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
+ var/datum/db_query/query_option_options = SSdbcore.NewQuery({"
+ SELECT id, text
+ FROM [format_table_name("poll_option")]
+ WHERE pollid = :id
+ "}, list(
+ "id" = pollid
+ ))
if(!query_option_options.warn_execute())
qdel(query_option_options)
return
@@ -92,7 +115,14 @@
src << browse(null ,"window=playerpolllist")
src << browse(output,"window=playerpoll;size=500x250")
if(POLLTYPE_TEXT)
- var/datum/db_query/query_text_get_votes = SSdbcore.NewQuery("SELECT replytext FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
+ var/datum/db_query/query_text_get_votes = SSdbcore.NewQuery({"
+ SELECT replytext
+ FROM [format_table_name("poll_textreply")]
+ WHERE pollid = :id AND ckey = :ckey
+ "}, list(
+ "id" = pollid,
+ "ckey" = ckey
+ ))
if(!query_text_get_votes.warn_execute())
qdel(query_text_get_votes)
return
@@ -120,7 +150,13 @@
src << browse(null ,"window=playerpolllist")
src << browse(output,"window=playerpoll;size=500x500")
if(POLLTYPE_RATING)
- var/datum/db_query/query_rating_get_votes = SSdbcore.NewQuery("SELECT o.text, v.rating FROM [format_table_name("poll_option")] o, [format_table_name("poll_vote")] v WHERE o.pollid = [pollid] AND v.ckey = '[ckey]' AND o.id = v.optionid")
+ var/datum/db_query/query_rating_get_votes = SSdbcore.NewQuery({"
+ SELECT o.text, v.rating FROM [format_table_name("poll_option")] o, [format_table_name("poll_vote")] v
+ WHERE o.pollid = :id AND v.ckey = :ckey AND o.id = v.optionid
+ "}, list(
+ "id" = pollid,
+ "ckey" = ckey
+ ))
if(!query_rating_get_votes.warn_execute())
qdel(query_rating_get_votes)
return
@@ -140,7 +176,13 @@
output += ""
var/minid = 999999
var/maxid = 0
- var/datum/db_query/query_rating_options = SSdbcore.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
+ var/datum/db_query/query_rating_options = SSdbcore.NewQuery({"
+ SELECT id, text, minval, maxval, descmin, descmid, descmax
+ FROM [format_table_name("poll_option")]
+ WHERE pollid = :id
+ "}, list(
+ "id" = pollid
+ ))
if(!query_rating_options.warn_execute())
qdel(query_rating_options)
return
@@ -177,7 +219,14 @@
src << browse(null ,"window=playerpolllist")
src << browse(output,"window=playerpoll;size=500x500")
if(POLLTYPE_MULTI)
- var/datum/db_query/query_multi_get_votes = SSdbcore.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
+ var/datum/db_query/query_multi_get_votes = SSdbcore.NewQuery({"
+ SELECT optionid
+ FROM [format_table_name("poll_vote")]
+ WHERE pollid = :id AND ckey = :ckey
+ "}, list(
+ "id" = pollid,
+ "ckey" = ckey
+ ))
if(!query_multi_get_votes.warn_execute())
qdel(query_multi_get_votes)
return
@@ -188,7 +237,13 @@
var/list/datum/polloption/options = list()
var/maxoptionid = 0
var/minoptionid = 0
- var/datum/db_query/query_multi_options = SSdbcore.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
+ var/datum/db_query/query_multi_options = SSdbcore.NewQuery({"
+ SELECT id, text
+ FROM [format_table_name("poll_option")]
+ WHERE pollid = :id
+ "}, list(
+ "id" = pollid
+ ))
if(!query_multi_options.warn_execute())
qdel(query_multi_options)
return
@@ -232,7 +287,14 @@
var/datum/asset/irv_assets = get_asset_datum(/datum/asset/group/irv)
irv_assets.send(src)
- var/datum/db_query/query_irv_get_votes = SSdbcore.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
+ var/datum/db_query/query_irv_get_votes = SSdbcore.NewQuery({"
+ SELECT optionid
+ FROM [format_table_name("poll_vote")]
+ WHERE pollid = :id AND ckey = :ckey
+ "}, list(
+ "id" = pollid,
+ "ckey" = ckey
+ ))
if(!query_irv_get_votes.warn_execute())
qdel(query_irv_get_votes)
return
@@ -244,7 +306,13 @@
var/list/datum/polloption/options = list()
- var/datum/db_query/query_irv_options = SSdbcore.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
+ var/datum/db_query/query_irv_options = SSdbcore.NewQuery({"
+ SELECT id, text
+ FROM [format_table_name("poll_option")]
+ WHERE pollid = :id
+ "}, list(
+ "id" = pollid
+ ))
if(!query_irv_options.warn_execute())
qdel(query_irv_options)
return
@@ -352,16 +420,23 @@
if (text)
table = "poll_textreply"
if (!SSdbcore.Connect())
- to_chat(usr, "Failed to establish database connection.")
+ to_chat(usr, "Failed to establish database connection.", confidential = TRUE)
return
- var/datum/db_query/query_hasvoted = SSdbcore.NewQuery("SELECT id FROM `[format_table_name(table)]` WHERE pollid = [pollid] AND ckey = '[ckey]'")
+ var/datum/db_query/query_hasvoted = SSdbcore.NewQuery({"
+ SELECT id
+ FROM `[format_table_name(table)]`
+ WHERE pollid = :id AND ckey = :ckey
+ "}, list(
+ "id" = pollid,
+ "ckey" = ckey
+ ))
if(!query_hasvoted.warn_execute())
qdel(query_hasvoted)
return
if(query_hasvoted.NextRow())
qdel(query_hasvoted)
if(!silent)
- to_chat(usr, "You've already replied to this poll.")
+ to_chat(usr, "You've already replied to this poll.", confidential = TRUE)
return TRUE
qdel(query_hasvoted)
return FALSE
@@ -376,24 +451,31 @@
/mob/dead/new_player/proc/vote_rig_check()
if (usr != src)
if (!usr || !src)
- return 0
+ return FALSE
//we gots ourselfs a dirty cheater on our hands!
log_game("[key_name(usr)] attempted to rig the vote by voting as [key]")
message_admins("[key_name_admin(usr)] attempted to rig the vote by voting as [key]")
to_chat(usr, "You don't seem to be [key].")
to_chat(src, "Something went horribly wrong processing your vote. Please contact an administrator, they should have gotten a message about this")
- return 0
- return 1
+ return FALSE
+ return TRUE
/mob/dead/new_player/proc/vote_valid_check(pollid, holder, type)
if (!SSdbcore.Connect())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return 0
pollid = text2num(pollid)
if (!pollid || pollid < 0)
return 0
//validate the poll is actually the right type of poll and its still active
- var/datum/db_query/query_validate_poll = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime AND polltype = '[type]' [(holder ? "" : "AND adminonly = false")]")
+ var/datum/db_query/query_validate_poll = SSdbcore.NewQuery({"
+ SELECT id
+ FROM [format_table_name("poll_question")]
+ WHERE id = :id AND Now() BETWEEN starttime AND endtime AND polltype = :type [(holder ? "" : "AND adminonly = false")]
+ "}, list(
+ "id" = pollid,
+ "type" = type
+ ))
if(!query_validate_poll.warn_execute())
qdel(query_validate_poll)
return 0
@@ -405,7 +487,7 @@
/mob/dead/new_player/proc/vote_on_irv_poll(pollid, list/votelist)
if (!SSdbcore.Connect())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return 0
if (!vote_rig_check())
return 0
@@ -429,7 +511,13 @@
return 0
//lets collect the options
- var/datum/db_query/query_irv_id = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
+ var/datum/db_query/query_irv_id = SSdbcore.NewQuery({"
+ SELECT id
+ FROM [format_table_name("poll_option")]
+ WHERE pollid = :id
+ "}, list(
+ "id" = pollid
+ ))
if(!query_irv_id.warn_execute())
qdel(query_irv_id)
return 0
@@ -462,8 +550,12 @@
__unique_N++
if (sqlrowlist != "")
sqlrowlist += ", " //a comma (,) at the start of the first row to insert will trigger a SQL error
- sqlrowlist += "(Now(), :pollid, :vote[__unique_N], :ckey, INET_ATON(:address), :rank)"
- sql_args["vote[__unique_N]"] = vote
+ sqlrowlist += "(Now(), :pollid, :vote_[__unique_N], :ckey, INET_ATON(:address), :rank)"
+ sql_args["vote_[__unique_N]"] = vote
+ // this should THEORATICALY do something like
+ // Now() - Time
+ // pollid - Constant, this is a multiple choice vote.
+ // vote[__unique_N] - The data SPECIFIC to the vote number, but still bound to pollid
//now lets delete their old votes (if any)
var/datum/db_query/query_irv_del_old = SSdbcore.NewQuery({"
@@ -491,7 +583,7 @@
/mob/dead/new_player/proc/vote_on_poll(pollid, optionid)
if (!SSdbcore.Connect())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return 0
if (!vote_rig_check())
return 0
@@ -509,7 +601,13 @@
var/datum/db_query/query_option_vote = SSdbcore.NewQuery({"
INSERT INTO [format_table_name("poll_vote")] (datetime, pollid, optionid, ckey, ip, adminrank)
VALUES (Now(), :pollid, :optionid, :ckey, INET_ATON(:address), :adminrank)
- "}, list("pollid" = pollid, "optionid" = optionid, "ckey" = ckey, "address" = client.address, "adminrank" = adminrank))
+ "}, list(
+ "pollid" = pollid,
+ "optionid" = optionid,
+ "ckey" = ckey,
+ "address" = client.address,
+ "adminrank" = adminrank
+ ))
if(!query_option_vote.warn_execute())
qdel(query_option_vote)
return
@@ -520,7 +618,7 @@
/mob/dead/new_player/proc/log_text_poll_reply(pollid, replytext)
if (!SSdbcore.Connect())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return 0
if (!vote_rig_check())
return 0
@@ -562,7 +660,7 @@
/mob/dead/new_player/proc/vote_on_numval_poll(pollid, optionid, rating)
if (!SSdbcore.Connect())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return 0
if (!vote_rig_check())
return 0
@@ -571,7 +669,14 @@
//validate the poll
if (!vote_valid_check(pollid, client.holder, POLLTYPE_RATING))
return 0
- var/datum/db_query/query_numval_hasvoted = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE optionid = [optionid] AND ckey = '[ckey]'")
+ var/datum/db_query/query_numval_hasvoted = SSdbcore.NewQuery({"
+ SELECT id
+ FROM [format_table_name("poll_vote")]
+ WHERE optionid = :id AND ckey = :ckey
+ "}, list(
+ "id" = optionid,
+ "ckey" = ckey
+ ))
if(!query_numval_hasvoted.warn_execute())
qdel(query_numval_hasvoted)
return
@@ -597,7 +702,7 @@
/mob/dead/new_player/proc/vote_on_multi_poll(pollid, optionid)
if (!SSdbcore.Connect())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return 0
if (!vote_rig_check())
return 0
@@ -606,7 +711,12 @@
//validate the poll
if (!vote_valid_check(pollid, client.holder, POLLTYPE_MULTI))
return 0
- var/datum/db_query/query_multi_choicelen = SSdbcore.NewQuery("SELECT multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid]")
+ var/datum/db_query/query_multi_choicelen = SSdbcore.NewQuery({"
+ SELECT multiplechoiceoptions
+ FROM [format_table_name("poll_question")] WHERE id = :id
+ "}, list(
+ "id" = pollid
+ ))
if(!query_multi_choicelen.warn_execute())
qdel(query_multi_choicelen)
return 1
@@ -614,7 +724,14 @@
if(query_multi_choicelen.NextRow())
i = text2num(query_multi_choicelen.item[1])
qdel(query_multi_choicelen)
- var/datum/db_query/query_multi_hasvoted = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
+ var/datum/db_query/query_multi_hasvoted = SSdbcore.NewQuery({"
+ SELECT id
+ FROM [format_table_name("poll_vote")]
+ WHERE pollid = :id AND ckey = :ckey
+ "}, list(
+ "id" = pollid,
+ "ckey" = ckey
+ ))
if(!query_multi_hasvoted.warn_execute())
qdel(query_multi_hasvoted)
return 1
diff --git a/modular_citadel/code/modules/mentor/mentor_memo.dm b/modular_citadel/code/modules/mentor/mentor_memo.dm
index a92ec7232c..59ea92febd 100644
--- a/modular_citadel/code/modules/mentor/mentor_memo.dm
+++ b/modular_citadel/code/modules/mentor/mentor_memo.dm
@@ -4,7 +4,7 @@
if(!check_rights(0))
return
if(!SSdbcore.IsConnected())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return
var/memotask = input(usr,"Choose task.","Memo") in list("Show","Write","Edit","Remove")
if(!memotask)
@@ -17,7 +17,7 @@
if(!is_mentor())
return
if(!SSdbcore.IsConnected())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return
mentor_memo_output("Show")
@@ -25,7 +25,7 @@
if(!task)
return
if(!SSdbcore.IsConnected())
- to_chat(src, "Failed to establish database connection.")
+ to_chat(src, "Failed to establish database connection.", confidential = TRUE)
return
switch(task)
if("Write")