Refactors dbcon into a subsystem

This commit is contained in:
CitadelStationBot
2017-04-17 09:46:09 -05:00
parent 21827263f5
commit 278cbbaf35
25 changed files with 372 additions and 149 deletions
+3 -3
View File
@@ -35,7 +35,7 @@
if (!GLOB.guests_allowed)
log_access("Failed Login: [key] - Guests not allowed")
return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.")
if (config.panic_bunker && GLOB.dbcon && GLOB.dbcon.IsConnected())
if (config.panic_bunker && SSdbcore && SSdbcore.IsConnected())
log_access("Failed Login: [key] - Guests not allowed during panic bunker")
return list("reason"="guest", "desc"="\nReason: Sorry but the server is currently not accepting connections from never before seen players or guests. If you have played on this server with a byond account before, please log in to the byond account you have played from.")
@@ -61,7 +61,7 @@
var/ckeytext = ckey(key)
if(!GLOB.dbcon.Connect())
if(!SSdbcore.Connect())
log_world("Ban database connection failure. Key [ckeytext] not checked")
GLOB.diary << "Ban database connection failure. Key [ckeytext] not checked"
return
@@ -74,7 +74,7 @@
if(computer_id)
cidquery = " OR computerid = '[computer_id]' "
var/DBQuery/query_ban_check = GLOB.dbcon.NewQuery("SELECT ckey, a_ckey, reason, expiration_time, duration, bantime, bantype FROM [format_table_name("ban")] WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR bantype = 'ADMIN_PERMABAN' OR ((bantype = 'TEMPBAN' OR bantype = 'ADMIN_TEMPBAN') AND expiration_time > Now())) AND isnull(unbanned)")
var/datum/DBQuery/query_ban_check = SSdbcore.NewQuery("SELECT ckey, a_ckey, reason, expiration_time, duration, bantime, bantype FROM [format_table_name("ban")] WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR bantype = 'ADMIN_PERMABAN' OR ((bantype = 'TEMPBAN' OR bantype = 'ADMIN_TEMPBAN') AND expiration_time > Now())) AND isnull(unbanned)")
if(!query_ban_check.Execute())
return
while(query_ban_check.NextRow())