mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-31 09:00:25 +01:00
Ports the TG globals controller and converts globals. (#18057)
* SDQL2 update * fix that verb * cl * fix that * toworld * this is pointless * update info * siiiiick.. * vv edit update * fix that * fix editing vars * fix VV * Port the /TG/ globals controller. * part 1 * part 2 * oops * part 3 * Hollow Purple * sadas * bsbsdb * muda na agaki ta * ids 1-15 * 16-31 * 41-75 * bring me back to how things used to be before i lost it all * the strength of mayhem * final touches * cl * protect some vars * update sdql2 to use glob * stuff? * forgot that is not defined there * whoops * observ * but it never gets better * a --------- Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
if (!ckey || !address || !computer_id || !ban_id)
|
||||
return
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
if (!establish_db_connection(GLOB.dbcon))
|
||||
log_world("ERROR: Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
|
||||
log_misc("Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
|
||||
return
|
||||
|
||||
var/bad_data = BAD_CKEY|BAD_IP|BAD_CID
|
||||
|
||||
var/DBQuery/original_ban = dbcon.NewQuery("SELECT ckey, ip, computerid FROM ss13_ban WHERE id = :ban_id:")
|
||||
var/DBQuery/original_ban = GLOB.dbcon.NewQuery("SELECT ckey, ip, computerid FROM ss13_ban WHERE id = :ban_id:")
|
||||
original_ban.Execute(list("ban_id" = ban_id))
|
||||
|
||||
if (original_ban.NextRow())
|
||||
@@ -28,7 +28,7 @@
|
||||
bad_data &= ~BAD_CID
|
||||
|
||||
if (bad_data)
|
||||
var/DBQuery/mirrored_bans = dbcon.NewQuery("SELECT ckey, ip, computerid FROM ss13_ban_mirrors WHERE isnull(deleted_at) AND ban_id = :ban_id:")
|
||||
var/DBQuery/mirrored_bans = GLOB.dbcon.NewQuery("SELECT ckey, ip, computerid FROM ss13_ban_mirrors WHERE isnull(deleted_at) AND ban_id = :ban_id:")
|
||||
mirrored_bans.Execute(list("ban_id" = ban_id))
|
||||
|
||||
while (mirrored_bans.NextRow())
|
||||
@@ -57,12 +57,12 @@
|
||||
if (!ckey || !address || !computer_id)
|
||||
return null
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
if (!establish_db_connection(GLOB.dbcon))
|
||||
log_world("ERROR: Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
|
||||
log_misc("Ban database connection failure while attempting to check mirrors. Key passed for mirror checking: [ckey].")
|
||||
return null
|
||||
|
||||
var/DBQuery/initial_query = dbcon.NewQuery("SELECT DISTINCT ban_id FROM ss13_ban_mirrors WHERE isnull(deleted_at) AND (ckey = :ckey: OR ip = :address: OR computerid = :computerid:)")
|
||||
var/DBQuery/initial_query = GLOB.dbcon.NewQuery("SELECT DISTINCT ban_id FROM ss13_ban_mirrors WHERE isnull(deleted_at) AND (ckey = :ckey: OR ip = :address: OR computerid = :computerid:)")
|
||||
initial_query.Execute(list("ckey" = ckey, "address" = address, "computerid" = computer_id))
|
||||
|
||||
var/list/ban_ids = list()
|
||||
@@ -74,7 +74,7 @@
|
||||
if (!ban_ids.len)
|
||||
return null
|
||||
|
||||
var/DBQuery/search_query = dbcon.NewQuery("SELECT id FROM ss13_ban WHERE id IN :vars: AND isnull(unbanned) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now()))")
|
||||
var/DBQuery/search_query = GLOB.dbcon.NewQuery("SELECT id FROM ss13_ban WHERE id IN :vars: AND isnull(unbanned) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now()))")
|
||||
search_query.Execute(list("vars" = ban_ids))
|
||||
|
||||
var/list/active_bans = list()
|
||||
@@ -98,7 +98,7 @@
|
||||
for (var/i = 1; i <= extra_info.len && i <= 50; i++)
|
||||
. |= extra_info[i][1]
|
||||
|
||||
var/DBQuery/new_mirror = dbcon.NewQuery("INSERT INTO ss13_ban_mirrors (id, ban_id, ckey, ip, computerid, source, extra_info, datetime) VALUES (NULL, :ban_id:, :ckey:, :address:, :computerid:, :source:, :info:, NOW())")
|
||||
var/DBQuery/new_mirror = GLOB.dbcon.NewQuery("INSERT INTO ss13_ban_mirrors (id, ban_id, ckey, ip, computerid, source, extra_info, datetime) VALUES (NULL, :ban_id:, :ckey:, :address:, :computerid:, :source:, :info:, NOW())")
|
||||
new_mirror.Execute(list("ban_id" = ban_id, "ckey" = ckey, "address" = address, "computerid" = computer_id, "source" = source, "info" = json_encode(.)))
|
||||
|
||||
log_misc("Mirrored ban #[ban_id] for player [ckey] from [address]-[computer_id].")
|
||||
@@ -107,10 +107,10 @@
|
||||
if (!ban_id)
|
||||
return null
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
if (!establish_db_connection(GLOB.dbcon))
|
||||
return null
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, ckey, ip, computerid, date(datetime) as datetime, source, extra_info, deleted_at FROM ss13_ban_mirrors WHERE ban_id = :ban_id:")
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT id, ckey, ip, computerid, date(datetime) as datetime, source, extra_info, deleted_at FROM ss13_ban_mirrors WHERE ban_id = :ban_id:")
|
||||
query.Execute(list("ban_id" = ban_id))
|
||||
|
||||
var/list/mirrors = list()
|
||||
@@ -194,11 +194,11 @@
|
||||
if (!user || !check_rights(R_MOD|R_ADMIN) || !mirror_id)
|
||||
return
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
if (!establish_db_connection(GLOB.dbcon))
|
||||
to_chat(user, "<span class='warning'>Database connection failed!</span>")
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT extra_info, ban_id FROM ss13_ban_mirrors WHERE id = :id:")
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT extra_info, ban_id FROM ss13_ban_mirrors WHERE id = :id:")
|
||||
query.Execute(list("id" = mirror_id))
|
||||
|
||||
if (!query.NextRow())
|
||||
@@ -229,13 +229,13 @@
|
||||
if (!user || !check_rights(R_MOD|R_ADMIN) || !mirror_id)
|
||||
return
|
||||
|
||||
if (!establish_db_connection(dbcon))
|
||||
if (!establish_db_connection(GLOB.dbcon))
|
||||
to_chat(user, "<span class='warning'>Database connection failed!</span>")
|
||||
return
|
||||
|
||||
var/query_text = inactive ? "UPDATE ss13_ban_mirrors SET deleted_at = NULL WHERE id = :id:" : "UPDATE ss13_ban_mirrors SET deleted_at = NOW() WHERE id = :id:"
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery(query_text)
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery(query_text)
|
||||
query.Execute(list("id" = mirror_id))
|
||||
|
||||
if (query.ErrorMsg())
|
||||
@@ -272,15 +272,15 @@
|
||||
if (A & 2)
|
||||
count++
|
||||
|
||||
if (config.access_deny_vms && count >= config.access_deny_vms)
|
||||
log_access("Failed Login: [C.ckey] [C.address] [C.computer_id] - Matching [count]/[config.access_deny_vms] VM identifiers. IDs: [A].", ckey = C.ckey)
|
||||
message_admins("Failed Login: [C.ckey] [C.address] [C.computer_id] - Matching [count]/[config.access_deny_vms] VM identifiers. IDs: [A].")
|
||||
if (GLOB.config.access_deny_vms && count >= GLOB.config.access_deny_vms)
|
||||
log_access("Failed Login: [C.ckey] [C.address] [C.computer_id] - Matching [count]/[GLOB.config.access_deny_vms] VM identifiers. IDs: [A].", ckey = C.ckey)
|
||||
message_admins("Failed Login: [C.ckey] [C.address] [C.computer_id] - Matching [count]/[GLOB.config.access_deny_vms] VM identifiers. IDs: [A].")
|
||||
spawn(20)
|
||||
if (C)
|
||||
del(C)
|
||||
return
|
||||
|
||||
if (config.access_warn_vms && count >= config.access_warn_vms)
|
||||
if (GLOB.config.access_warn_vms && count >= GLOB.config.access_warn_vms)
|
||||
log_access("Notice: [key_name(C)] [C.address] [C.computer_id] - Matching [count] VM identifiers. IDs: [A].", ckey = C.ckey)
|
||||
message_admins("Notice: [key_name(C)] [C.address] [C.computer_id] - Matching [count] VM identifiers. IDs: [A].")
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
if (!holder)
|
||||
return
|
||||
|
||||
if(!establish_db_connection(dbcon))
|
||||
if(!establish_db_connection(GLOB.dbcon))
|
||||
return
|
||||
|
||||
var/serverip = "[world.internet_address]:[world.port]"
|
||||
@@ -51,7 +51,7 @@
|
||||
computerid = bancid
|
||||
ip = banip
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, computerid, ip FROM ss13_player WHERE ckey = '[ckey]'")
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT id, computerid, ip FROM ss13_player WHERE ckey = '[ckey]'")
|
||||
query.Execute()
|
||||
var/validckey = 0
|
||||
if(query.NextRow())
|
||||
@@ -80,7 +80,7 @@
|
||||
a_ip = world.address
|
||||
|
||||
var/who
|
||||
for(var/c in clients)
|
||||
for(var/c in GLOB.clients)
|
||||
var/client/C = c
|
||||
if(!who)
|
||||
who = "[C]"
|
||||
@@ -88,7 +88,7 @@
|
||||
who += ", [C]"
|
||||
|
||||
var/adminwho
|
||||
for(var/c in staff)
|
||||
for(var/c in GLOB.staff)
|
||||
var/client/C = c
|
||||
if(!adminwho)
|
||||
adminwho = "[C]"
|
||||
@@ -98,7 +98,7 @@
|
||||
reason = sql_sanitize_text(reason)
|
||||
|
||||
var/sql = "INSERT INTO ss13_ban (`id`,`bantime`,`serverip`,`game_id`,`bantype`,`reason`,`job`,`duration`,`rounds`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`,`edits`,`unbanned`,`unbanned_datetime`,`unbanned_ckey`,`unbanned_computerid`,`unbanned_ip`) VALUES (null, Now(), '[serverip]', '[game_id]','[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], [(rounds)?"[rounds]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', '[ip]', '[a_ckey]', '[a_computerid]', '[a_ip]', '[who]', '[adminwho]', '', null, null, null, null, null)"
|
||||
var/DBQuery/query_insert = dbcon.NewQuery(sql)
|
||||
var/DBQuery/query_insert = GLOB.dbcon.NewQuery(sql)
|
||||
query_insert.Execute()
|
||||
to_chat(usr, "<span class='notice'>Ban saved to database.</span>")
|
||||
message_admins("[key_name_admin(usr)] has added a [bantype_str] for [ckey] [(job)?"([job])":""] [(duration > 0)?"([duration] minutes)":""] with the reason: \"[reason]\" to the ban database.",1)
|
||||
@@ -138,13 +138,13 @@
|
||||
if(job)
|
||||
sql += " AND job = '[job]'"
|
||||
|
||||
if(!establish_db_connection(dbcon))
|
||||
if(!establish_db_connection(GLOB.dbcon))
|
||||
return
|
||||
|
||||
var/ban_id
|
||||
var/ban_number = 0 //failsafe
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery(sql)
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery(sql)
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
ban_id = query.item[1]
|
||||
@@ -174,7 +174,7 @@
|
||||
to_chat(usr, "Cancelled")
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, duration, reason FROM ss13_ban WHERE id = [banid]")
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery("SELECT ckey, duration, reason FROM ss13_ban WHERE id = [banid]")
|
||||
query.Execute()
|
||||
|
||||
var/eckey = usr.ckey //Editing admin ckey
|
||||
@@ -202,7 +202,7 @@
|
||||
to_chat(usr, "Cancelled")
|
||||
return
|
||||
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE ss13_ban SET reason = '[value]', edits = CONCAT(edits,'- [eckey] changed ban reason from <cite><b>\\\"[reason]\\\"</b></cite> to <cite><b>\\\"[value]\\\"</b></cite><BR>') WHERE id = [banid]")
|
||||
var/DBQuery/update_query = GLOB.dbcon.NewQuery("UPDATE ss13_ban SET reason = '[value]', edits = CONCAT(edits,'- [eckey] changed ban reason from <cite><b>\\\"[reason]\\\"</b></cite> to <cite><b>\\\"[value]\\\"</b></cite><BR>') WHERE id = [banid]")
|
||||
update_query.Execute()
|
||||
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s reason from [reason] to [value]",1)
|
||||
if("duration")
|
||||
@@ -212,7 +212,7 @@
|
||||
to_chat(usr, "Cancelled")
|
||||
return
|
||||
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE ss13_ban SET duration = [value], edits = CONCAT(edits,'- [eckey] changed ban duration from [duration] to [value]<br>'), expiration_time = DATE_ADD(bantime, INTERVAL [value] MINUTE) WHERE id = [banid]")
|
||||
var/DBQuery/update_query = GLOB.dbcon.NewQuery("UPDATE ss13_ban SET duration = [value], edits = CONCAT(edits,'- [eckey] changed ban duration from [duration] to [value]<br>'), expiration_time = DATE_ADD(bantime, INTERVAL [value] MINUTE) WHERE id = [banid]")
|
||||
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s duration from [duration] to [value]",1)
|
||||
update_query.Execute()
|
||||
if("unban")
|
||||
@@ -232,7 +232,7 @@
|
||||
|
||||
var/sql = "SELECT ckey, bantype, job FROM ss13_ban WHERE id = [id]"
|
||||
|
||||
if(!establish_db_connection(dbcon))
|
||||
if(!establish_db_connection(GLOB.dbcon))
|
||||
return
|
||||
|
||||
var/reason = input("Please specify an unban reason.", "Unban Reason", "Unbanned as per appeal.")
|
||||
@@ -245,7 +245,7 @@
|
||||
var/pckey
|
||||
var/ban_type
|
||||
var/job // This is for integrating the static jobban API into this.
|
||||
var/DBQuery/query = dbcon.NewQuery(sql)
|
||||
var/DBQuery/query = GLOB.dbcon.NewQuery(sql)
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
pckey = query.item[1]
|
||||
@@ -277,7 +277,7 @@
|
||||
var/sql_update = "UPDATE ss13_ban SET unbanned = 1, unbanned_datetime = Now(), unbanned_ckey = '[unban_ckey]', unbanned_computerid = '[unban_computerid]', unbanned_ip = '[unban_ip]', unbanned_reason = '[unban_reason]' WHERE id = [id]"
|
||||
message_admins("[key_name_admin(usr)] has lifted [pckey]'s ban.",1)
|
||||
|
||||
var/DBQuery/query_update = dbcon.NewQuery(sql_update)
|
||||
var/DBQuery/query_update = GLOB.dbcon.NewQuery(sql_update)
|
||||
query_update.Execute()
|
||||
|
||||
notes_add_sql(ckey(pckey), "[ban_type] (#[id]) lifted. Reason for unban: [reason].", usr)
|
||||
@@ -303,7 +303,7 @@
|
||||
|
||||
if(!check_rights(R_BAN)) return
|
||||
|
||||
if(!establish_db_connection(dbcon))
|
||||
if(!establish_db_connection(GLOB.dbcon))
|
||||
to_chat(usr, "<span class='warning'>Failed to establish database connection</span>")
|
||||
return
|
||||
|
||||
@@ -336,8 +336,8 @@
|
||||
for(var/j in nonhuman_positions)
|
||||
output += "<option value='[j]'>[j]</option>"
|
||||
var/list/bantypes = list("traitor","changeling","vampire","operative","revolutionary","cultist","wizard") //For legacy bans.
|
||||
for(var/antag_type in all_antag_types) // Grab other bans.
|
||||
var/datum/antagonist/antag = all_antag_types[antag_type]
|
||||
for(var/antag_type in GLOB.all_antag_types) // Grab other bans.
|
||||
var/datum/antagonist/antag = GLOB.all_antag_types[antag_type]
|
||||
bantypes |= antag.bantype
|
||||
for(var/j in bantypes)
|
||||
output += "<option value='[j]'>[j]</option>"
|
||||
@@ -433,7 +433,7 @@
|
||||
* Do mirror checks first! Basically find active mirrors and add those to the output before we proceed onto finding bans.
|
||||
*/
|
||||
if (!match)
|
||||
var/DBQuery/mirror_query = dbcon.NewQuery({"SELECT DISTINCT(mirrors.ban_id), bans.ckey FROM ss13_ban_mirrors mirrors
|
||||
var/DBQuery/mirror_query = GLOB.dbcon.NewQuery({"SELECT DISTINCT(mirrors.ban_id), bans.ckey FROM ss13_ban_mirrors mirrors
|
||||
JOIN ss13_ban bans ON mirrors.ban_id = bans.id
|
||||
WHERE (isnull(mirrors.deleted_at) AND (1 [mirror_player] [mirror_ip] [mirror_cid]))
|
||||
AND (
|
||||
@@ -465,7 +465,7 @@
|
||||
output += "<th width='15%'><b>OPTIONS</b></th>"
|
||||
output += "</tr>"
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, unbanned_reason, edits, ip, computerid FROM ss13_ban WHERE 1 [playersearch] [adminsearch] [ipsearch] [cidsearch] [bantypesearch] ORDER BY bantime DESC LIMIT 100")
|
||||
var/DBQuery/select_query = GLOB.dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, unbanned_reason, edits, ip, computerid FROM ss13_ban WHERE 1 [playersearch] [adminsearch] [ipsearch] [cidsearch] [bantypesearch] ORDER BY bantime DESC LIMIT 100")
|
||||
select_query.Execute()
|
||||
|
||||
var/now = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss") // MUST BE the same format as SQL gives us the dates in, and MUST be least to most specific (i.e. year, month, day not day, month, year)
|
||||
@@ -546,7 +546,7 @@
|
||||
output += "</tr>"
|
||||
if (bantype in list("PERMABAN", "TEMPBAN"))
|
||||
var/mirror_count = 0
|
||||
var/DBQuery/get_mirrors = dbcon.NewQuery("SELECT id FROM ss13_ban_mirrors WHERE ban_id = :ban_id:")
|
||||
var/DBQuery/get_mirrors = GLOB.dbcon.NewQuery("SELECT id FROM ss13_ban_mirrors WHERE ban_id = :ban_id:")
|
||||
get_mirrors.Execute(list("ban_id" = text2num(banid)))
|
||||
|
||||
while (get_mirrors.NextRow())
|
||||
|
||||
Reference in New Issue
Block a user