mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Refactors dbcon into a subsystem (#26134)
* Refactors dbcon into a subsystem * Swear I got that already...
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/client/proc/join_date_check(y,m,d)
|
/client/proc/join_date_check(y,m,d)
|
||||||
var/DBQuery/query_datediff = GLOB.dbcon.NewQuery("SELECT DATEDIFF(Now(),'[y]-[m]-[d]')")
|
var/datum/DBQuery/query_datediff = SSdbcore.NewQuery("SELECT DATEDIFF(Now(),'[y]-[m]-[d]')")
|
||||||
|
|
||||||
if(!query_datediff.Execute())
|
if(!query_datediff.Execute())
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
// Run all strings to be used in an SQL query through this proc first to properly escape out injection attempts.
|
// Run all strings to be used in an SQL query through this proc first to properly escape out injection attempts.
|
||||||
/proc/sanitizeSQL(t)
|
/proc/sanitizeSQL(t)
|
||||||
var/sqltext = GLOB.dbcon.Quote("[t]");
|
var/sqltext = SSdbcore.Quote("[t]");
|
||||||
return copytext(sqltext, 2, lentext(sqltext));//Quote() adds quotes around input, we already do that
|
return copytext(sqltext, 2, lentext(sqltext));//Quote() adds quotes around input, we already do that
|
||||||
|
|
||||||
/proc/format_table_name(table as text)
|
/proc/format_table_name(table as text)
|
||||||
|
|||||||
@@ -13,9 +13,4 @@ GLOBAL_DATUM(data_core, /datum/datacore)
|
|||||||
GLOBAL_VAR_INIT(CELLRATE, 0.002) // multiplier for watts per tick <> cell storage (eg: .002 means if there is a load of 1000 watts, 20 units will be taken from a cell per second)
|
GLOBAL_VAR_INIT(CELLRATE, 0.002) // multiplier for watts per tick <> cell storage (eg: .002 means if there is a load of 1000 watts, 20 units will be taken from a cell per second)
|
||||||
GLOBAL_VAR_INIT(CHARGELEVEL, 0.001) // Cap for how fast cells charge, as a percentage-per-tick (.001 means cellcharge is capped to 1% per second)
|
GLOBAL_VAR_INIT(CHARGELEVEL, 0.001) // Cap for how fast cells charge, as a percentage-per-tick (.001 means cellcharge is capped to 1% per second)
|
||||||
|
|
||||||
GLOBAL_LIST_EMPTY(powernets)
|
GLOBAL_LIST_EMPTY(powernets)
|
||||||
|
|
||||||
//Database connections
|
|
||||||
//A connection is established on world creation. Ideally, the connection dies when the server restarts (After feedback logging.).
|
|
||||||
GLOBAL_DATUM_INIT(dbcon, /DBConnection, new) //Feedback database (New database)
|
|
||||||
GLOBAL_PROTECT(dbcon)
|
|
||||||
220
code/controllers/subsystem/dbcore.dm
Normal file
220
code/controllers/subsystem/dbcore.dm
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
SUBSYSTEM_DEF(dbcore)
|
||||||
|
name = "Database"
|
||||||
|
flags = SS_NO_INIT|SS_NO_FIRE
|
||||||
|
|
||||||
|
var/const/FAILED_DB_CONNECTION_CUTOFF = 5
|
||||||
|
|
||||||
|
var/const/Default_Cursor = 0
|
||||||
|
var/const/Client_Cursor = 1
|
||||||
|
var/const/Server_Cursor = 2
|
||||||
|
//conversions
|
||||||
|
var/const/TEXT_CONV = 1
|
||||||
|
var/const/RSC_FILE_CONV = 2
|
||||||
|
var/const/NUMBER_CONV = 3
|
||||||
|
//column flag values:
|
||||||
|
var/const/IS_NUMERIC = 1
|
||||||
|
var/const/IS_BINARY = 2
|
||||||
|
var/const/IS_NOT_NULL = 4
|
||||||
|
var/const/IS_PRIMARY_KEY = 8
|
||||||
|
var/const/IS_UNSIGNED = 16
|
||||||
|
// TODO: Investigate more recent type additions and see if I can handle them. - Nadrew
|
||||||
|
|
||||||
|
var/_db_con// This variable contains a reference to the actual database connection.
|
||||||
|
var/failed_connections = 0
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/PreInit()
|
||||||
|
_db_con = _dm_db_new_con()
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/Recover()
|
||||||
|
_db_con = SSdbcore._db_con
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/Shutdown()
|
||||||
|
if(IsConnected())
|
||||||
|
Disconnect()
|
||||||
|
|
||||||
|
//nu
|
||||||
|
/datum/controller/subsystem/dbcore/can_vv_get(var_name)
|
||||||
|
return var_name != "_db_con" && ..()
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/vv_edit_var(var_name, var_value)
|
||||||
|
if(var_name == "_db_con")
|
||||||
|
return FALSE
|
||||||
|
return ..()
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/proc/Connect()
|
||||||
|
if(IsConnected())
|
||||||
|
return TRUE
|
||||||
|
|
||||||
|
if(failed_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect anymore.
|
||||||
|
return FALSE
|
||||||
|
|
||||||
|
if(!config.sql_enabled)
|
||||||
|
return FALSE
|
||||||
|
|
||||||
|
var/user = global.sqlfdbklogin
|
||||||
|
var/pass = global.sqlfdbkpass
|
||||||
|
var/db = global.sqlfdbkdb
|
||||||
|
var/address = global.sqladdress
|
||||||
|
var/port = global.sqlport
|
||||||
|
|
||||||
|
doConnect("dbi:mysql:[db]:[address]:[port]", user, pass)
|
||||||
|
. = IsConnected()
|
||||||
|
if (!.)
|
||||||
|
log_sql("Connect() failed | [ErrorMsg()]")
|
||||||
|
++failed_connections
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/proc/doConnect(dbi_handler, user_handler, password_handler)
|
||||||
|
if(!config.sql_enabled)
|
||||||
|
return FALSE
|
||||||
|
return _dm_db_connect(_db_con, dbi_handler, user_handler, password_handler, Default_Cursor, null)
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/proc/Disconnect()
|
||||||
|
failed_connections = 0
|
||||||
|
return _dm_db_close(_db_con)
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/proc/IsConnected()
|
||||||
|
if(!config.sql_enabled)
|
||||||
|
return FALSE
|
||||||
|
return _dm_db_is_connected(_db_con)
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/proc/Quote(str)
|
||||||
|
return _dm_db_quote(_db_con, str)
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/proc/ErrorMsg()
|
||||||
|
return _dm_db_error_msg(_db_con)
|
||||||
|
|
||||||
|
/datum/controller/subsystem/dbcore/proc/NewQuery(sql_query, cursor_handler = Default_Cursor)
|
||||||
|
if(IsAdminAdvancedProcCall())
|
||||||
|
log_admin_private("WARNING: Advanced admin proc call DB query created!: [sql_query]")
|
||||||
|
return new /datum/DBQuery(sql_query, src, cursor_handler)
|
||||||
|
|
||||||
|
|
||||||
|
/datum/DBQuery
|
||||||
|
var/sql // The sql query being executed.
|
||||||
|
var/default_cursor
|
||||||
|
var/list/columns //list of DB Columns populated by Columns()
|
||||||
|
var/list/conversions
|
||||||
|
var/list/item //list of data values populated by NextRow()
|
||||||
|
|
||||||
|
var/datum/controller/subsystem/dbcore/db_connection
|
||||||
|
var/_db_query
|
||||||
|
|
||||||
|
/datum/DBQuery/New(sql_query, datum/controller/subsystem/dbcore/connection_handler, cursor_handler)
|
||||||
|
if(sql_query)
|
||||||
|
sql = sql_query
|
||||||
|
if(connection_handler)
|
||||||
|
db_connection = connection_handler
|
||||||
|
if(cursor_handler)
|
||||||
|
default_cursor = cursor_handler
|
||||||
|
item = list()
|
||||||
|
_db_query = _dm_db_new_query()
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/Connect(datum/controller/subsystem/dbcore/connection_handler)
|
||||||
|
db_connection = connection_handler
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/warn_execute()
|
||||||
|
. = Execute()
|
||||||
|
if(!.)
|
||||||
|
to_chat(usr, "<span class='danger'>A SQL error occured during this operation, check the server logs.</span>")
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/Execute(sql_query = sql, cursor_handler = default_cursor, log_error = TRUE)
|
||||||
|
Close()
|
||||||
|
. = _dm_db_execute(_db_query, sql_query, db_connection._db_con, cursor_handler, null)
|
||||||
|
if(!. && log_error)
|
||||||
|
log_sql("[ErrorMsg()] | Query used: [sql]")
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/NextRow()
|
||||||
|
return _dm_db_next_row(_db_query,item,conversions)
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/RowsAffected()
|
||||||
|
return _dm_db_rows_affected(_db_query)
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/RowCount()
|
||||||
|
return _dm_db_row_count(_db_query)
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/ErrorMsg()
|
||||||
|
return _dm_db_error_msg(_db_query)
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/Columns()
|
||||||
|
if(!columns)
|
||||||
|
columns = _dm_db_columns(_db_query, /datum/DBColumn)
|
||||||
|
return columns
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/GetRowData()
|
||||||
|
var/list/columns = Columns()
|
||||||
|
var/list/results
|
||||||
|
if(columns.len)
|
||||||
|
results = list()
|
||||||
|
for(var/C in columns)
|
||||||
|
results+=C
|
||||||
|
var/datum/DBColumn/cur_col = columns[C]
|
||||||
|
results[C] = src.item[(cur_col.position+1)]
|
||||||
|
return results
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/Close()
|
||||||
|
item.Cut()
|
||||||
|
columns = null
|
||||||
|
conversions = null
|
||||||
|
return _dm_db_close(_db_query)
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/Quote(str)
|
||||||
|
return db_connection.Quote(str)
|
||||||
|
|
||||||
|
/datum/DBQuery/proc/SetConversion(column,conversion)
|
||||||
|
if(istext(column))
|
||||||
|
column = columns.Find(column)
|
||||||
|
if(!conversions)
|
||||||
|
conversions = list(column)
|
||||||
|
else if(conversions.len < column)
|
||||||
|
conversions.len = column
|
||||||
|
conversions[column] = conversion
|
||||||
|
|
||||||
|
|
||||||
|
/datum/DBColumn
|
||||||
|
var/name
|
||||||
|
var/table
|
||||||
|
var/position //1-based index into item data
|
||||||
|
var/sql_type
|
||||||
|
var/flags
|
||||||
|
var/length
|
||||||
|
var/max_length
|
||||||
|
//types
|
||||||
|
var/const/TINYINT = 1
|
||||||
|
var/const/SMALLINT = 2
|
||||||
|
var/const/MEDIUMINT = 3
|
||||||
|
var/const/INTEGER = 4
|
||||||
|
var/const/BIGINT = 5
|
||||||
|
var/const/DECIMAL = 6
|
||||||
|
var/const/FLOAT = 7
|
||||||
|
var/const/DOUBLE = 8
|
||||||
|
var/const/DATE = 9
|
||||||
|
var/const/DATETIME = 10
|
||||||
|
var/const/TIMESTAMP = 11
|
||||||
|
var/const/TIME = 12
|
||||||
|
var/const/STRING = 13
|
||||||
|
var/const/BLOB = 14
|
||||||
|
|
||||||
|
/datum/DBColumn/New(name_handler, table_handler, position_handler, type_handler, flag_handler, length_handler, max_length_handler)
|
||||||
|
name = name_handler
|
||||||
|
table = table_handler
|
||||||
|
position = position_handler
|
||||||
|
sql_type = type_handler
|
||||||
|
flags = flag_handler
|
||||||
|
length = length_handler
|
||||||
|
max_length = max_length_handler
|
||||||
|
|
||||||
|
/datum/DBColumn/proc/SqlTypeName(type_handler = sql_type)
|
||||||
|
switch(type_handler)
|
||||||
|
if(TINYINT) return "TINYINT"
|
||||||
|
if(SMALLINT) return "SMALLINT"
|
||||||
|
if(MEDIUMINT) return "MEDIUMINT"
|
||||||
|
if(INTEGER) return "INTEGER"
|
||||||
|
if(BIGINT) return "BIGINT"
|
||||||
|
if(FLOAT) return "FLOAT"
|
||||||
|
if(DOUBLE) return "DOUBLE"
|
||||||
|
if(DATE) return "DATE"
|
||||||
|
if(DATETIME) return "DATETIME"
|
||||||
|
if(TIMESTAMP) return "TIMESTAMP"
|
||||||
|
if(TIME) return "TIME"
|
||||||
|
if(STRING) return "STRING"
|
||||||
|
if(BLOB) return "BLOB"
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
if(!check_rights(R_BAN))
|
if(!check_rights(R_BAN))
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
computerid = bancid
|
computerid = bancid
|
||||||
ip = banip
|
ip = banip
|
||||||
|
|
||||||
var/DBQuery/query_add_ban_get_id = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("player")] WHERE ckey = '[ckey]'")
|
var/datum/DBQuery/query_add_ban_get_id = SSdbcore.NewQuery("SELECT id FROM [format_table_name("player")] WHERE ckey = '[ckey]'")
|
||||||
if(!query_add_ban_get_id.warn_execute())
|
if(!query_add_ban_get_id.warn_execute())
|
||||||
return
|
return
|
||||||
var/validckey = 0
|
var/validckey = 0
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
reason = sanitizeSQL(reason)
|
reason = sanitizeSQL(reason)
|
||||||
|
|
||||||
if(maxadminbancheck)
|
if(maxadminbancheck)
|
||||||
var/DBQuery/query_check_adminban_amt = GLOB.dbcon.NewQuery("SELECT count(id) AS num FROM [format_table_name("ban")] WHERE (a_ckey = '[a_ckey]') AND (bantype = 'ADMIN_PERMABAN' OR (bantype = 'ADMIN_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
|
var/datum/DBQuery/query_check_adminban_amt = SSdbcore.NewQuery("SELECT count(id) AS num FROM [format_table_name("ban")] WHERE (a_ckey = '[a_ckey]') AND (bantype = 'ADMIN_PERMABAN' OR (bantype = 'ADMIN_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
|
||||||
if(!query_check_adminban_amt.warn_execute())
|
if(!query_check_adminban_amt.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_check_adminban_amt.NextRow())
|
if(query_check_adminban_amt.NextRow())
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
if(!ip)
|
if(!ip)
|
||||||
ip = "0.0.0.0"
|
ip = "0.0.0.0"
|
||||||
var/sql = "INSERT INTO [format_table_name("ban")] (`bantime`,`server_ip`,`server_port`,`bantype`,`reason`,`job`,`duration`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`) VALUES (Now(), INET_ATON('[world.internet_address]'), '[world.port]', '[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', INET_ATON('[ip]'), '[a_ckey]', '[a_computerid]', INET_ATON('[a_ip]'), '[who]', '[adminwho]')"
|
var/sql = "INSERT INTO [format_table_name("ban")] (`bantime`,`server_ip`,`server_port`,`bantype`,`reason`,`job`,`duration`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`) VALUES (Now(), INET_ATON('[world.internet_address]'), '[world.port]', '[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', INET_ATON('[ip]'), '[a_ckey]', '[a_computerid]', INET_ATON('[a_ip]'), '[who]', '[adminwho]')"
|
||||||
var/DBQuery/query_add_ban = GLOB.dbcon.NewQuery(sql)
|
var/datum/DBQuery/query_add_ban = SSdbcore.NewQuery(sql)
|
||||||
if(!query_add_ban.warn_execute())
|
if(!query_add_ban.warn_execute())
|
||||||
return
|
return
|
||||||
to_chat(usr, "<span class='adminnotice'>Ban saved to database.</span>")
|
to_chat(usr, "<span class='adminnotice'>Ban saved to database.</span>")
|
||||||
@@ -187,13 +187,13 @@
|
|||||||
if(job)
|
if(job)
|
||||||
sql += " AND job = '[job]'"
|
sql += " AND job = '[job]'"
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
|
|
||||||
var/ban_id
|
var/ban_id
|
||||||
var/ban_number = 0 //failsafe
|
var/ban_number = 0 //failsafe
|
||||||
|
|
||||||
var/DBQuery/query_unban_get_id = GLOB.dbcon.NewQuery(sql)
|
var/datum/DBQuery/query_unban_get_id = SSdbcore.NewQuery(sql)
|
||||||
if(!query_unban_get_id.warn_execute())
|
if(!query_unban_get_id.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_unban_get_id.NextRow())
|
while(query_unban_get_id.NextRow())
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
to_chat(usr, "Cancelled")
|
to_chat(usr, "Cancelled")
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_edit_ban_get_details = GLOB.dbcon.NewQuery("SELECT ckey, duration, reason FROM [format_table_name("ban")] WHERE id = [banid]")
|
var/datum/DBQuery/query_edit_ban_get_details = SSdbcore.NewQuery("SELECT ckey, duration, reason FROM [format_table_name("ban")] WHERE id = [banid]")
|
||||||
if(!query_edit_ban_get_details.warn_execute())
|
if(!query_edit_ban_get_details.warn_execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
to_chat(usr, "Cancelled")
|
to_chat(usr, "Cancelled")
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_edit_ban_reason = GLOB.dbcon.NewQuery("UPDATE [format_table_name("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/datum/DBQuery/query_edit_ban_reason = SSdbcore.NewQuery("UPDATE [format_table_name("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]")
|
||||||
if(!query_edit_ban_reason.warn_execute())
|
if(!query_edit_ban_reason.warn_execute())
|
||||||
return
|
return
|
||||||
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s reason from [reason] to [value]",1)
|
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s reason from [reason] to [value]",1)
|
||||||
@@ -265,7 +265,7 @@
|
|||||||
to_chat(usr, "Cancelled")
|
to_chat(usr, "Cancelled")
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_edit_ban_duration = GLOB.dbcon.NewQuery("UPDATE [format_table_name("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/datum/DBQuery/query_edit_ban_duration = SSdbcore.NewQuery("UPDATE [format_table_name("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]")
|
||||||
if(!query_edit_ban_duration.warn_execute())
|
if(!query_edit_ban_duration.warn_execute())
|
||||||
return
|
return
|
||||||
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s duration from [duration] to [value]",1)
|
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s duration from [duration] to [value]",1)
|
||||||
@@ -287,13 +287,13 @@
|
|||||||
|
|
||||||
var/sql = "SELECT ckey FROM [format_table_name("ban")] WHERE id = [id]"
|
var/sql = "SELECT ckey FROM [format_table_name("ban")] WHERE id = [id]"
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
|
|
||||||
var/ban_number = 0 //failsafe
|
var/ban_number = 0 //failsafe
|
||||||
|
|
||||||
var/pckey
|
var/pckey
|
||||||
var/DBQuery/query_unban_get_ckey = GLOB.dbcon.NewQuery(sql)
|
var/datum/DBQuery/query_unban_get_ckey = SSdbcore.NewQuery(sql)
|
||||||
if(!query_unban_get_ckey.warn_execute())
|
if(!query_unban_get_ckey.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_unban_get_ckey.NextRow())
|
while(query_unban_get_ckey.NextRow())
|
||||||
@@ -316,7 +316,7 @@
|
|||||||
var/unban_ip = src.owner:address
|
var/unban_ip = src.owner:address
|
||||||
|
|
||||||
var/sql_update = "UPDATE [format_table_name("ban")] SET unbanned = 1, unbanned_datetime = Now(), unbanned_ckey = '[unban_ckey]', unbanned_computerid = '[unban_computerid]', unbanned_ip = INET_ATON('[unban_ip]') WHERE id = [id]"
|
var/sql_update = "UPDATE [format_table_name("ban")] SET unbanned = 1, unbanned_datetime = Now(), unbanned_ckey = '[unban_ckey]', unbanned_computerid = '[unban_computerid]', unbanned_ip = INET_ATON('[unban_ip]') WHERE id = [id]"
|
||||||
var/DBQuery/query_unban = GLOB.dbcon.NewQuery(sql_update)
|
var/datum/DBQuery/query_unban = SSdbcore.NewQuery(sql_update)
|
||||||
if(!query_unban.warn_execute())
|
if(!query_unban.warn_execute())
|
||||||
return
|
return
|
||||||
message_admins("[key_name_admin(usr)] has lifted [pckey]'s ban.",1)
|
message_admins("[key_name_admin(usr)] has lifted [pckey]'s ban.",1)
|
||||||
@@ -339,7 +339,7 @@
|
|||||||
if(!check_rights(R_BAN))
|
if(!check_rights(R_BAN))
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@
|
|||||||
var/bansperpage = 15
|
var/bansperpage = 15
|
||||||
var/pagecount = 0
|
var/pagecount = 0
|
||||||
page = text2num(page)
|
page = text2num(page)
|
||||||
var/DBQuery/query_count_bans = GLOB.dbcon.NewQuery("SELECT COUNT(id) FROM [format_table_name("ban")] WHERE 1 [playersearch] [adminsearch]")
|
var/datum/DBQuery/query_count_bans = SSdbcore.NewQuery("SELECT COUNT(id) FROM [format_table_name("ban")] WHERE 1 [playersearch] [adminsearch]")
|
||||||
if(!query_count_bans.warn_execute())
|
if(!query_count_bans.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_count_bans.NextRow())
|
if(query_count_bans.NextRow())
|
||||||
@@ -431,7 +431,7 @@
|
|||||||
output += "<th width='15%'><b>OPTIONS</b></th>"
|
output += "<th width='15%'><b>OPTIONS</b></th>"
|
||||||
output += "</tr>"
|
output += "</tr>"
|
||||||
var/limit = " LIMIT [bansperpage * page], [bansperpage]"
|
var/limit = " LIMIT [bansperpage * page], [bansperpage]"
|
||||||
var/DBQuery/query_search_bans = GLOB.dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, edits FROM [format_table_name("ban")] WHERE 1 [playersearch] [adminsearch] ORDER BY bantime DESC[limit]")
|
var/datum/DBQuery/query_search_bans = SSdbcore.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, edits FROM [format_table_name("ban")] WHERE 1 [playersearch] [adminsearch] ORDER BY bantime DESC[limit]")
|
||||||
if(!query_search_bans.warn_execute())
|
if(!query_search_bans.warn_execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
if (!GLOB.guests_allowed)
|
if (!GLOB.guests_allowed)
|
||||||
log_access("Failed Login: [key] - Guests not 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.")
|
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")
|
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.")
|
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)
|
var/ckeytext = ckey(key)
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
log_world("Ban database connection failure. Key [ckeytext] not checked")
|
log_world("Ban database connection failure. Key [ckeytext] not checked")
|
||||||
GLOB.diary << "Ban database connection failure. Key [ckeytext] not checked"
|
GLOB.diary << "Ban database connection failure. Key [ckeytext] not checked"
|
||||||
return
|
return
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
if(computer_id)
|
if(computer_id)
|
||||||
cidquery = " OR computerid = '[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())
|
if(!query_ban_check.Execute())
|
||||||
return
|
return
|
||||||
while(query_ban_check.NextRow())
|
while(query_ban_check.NextRow())
|
||||||
|
|||||||
@@ -125,14 +125,14 @@ GLOBAL_PROTECT(admin_ranks)
|
|||||||
|
|
||||||
previous_rights = R.rights
|
previous_rights = R.rights
|
||||||
else
|
else
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
log_world("Failed to connect to database in load_admin_ranks(). Reverting to legacy system.")
|
log_world("Failed to connect to database in load_admin_ranks(). Reverting to legacy system.")
|
||||||
GLOB.diary << "Failed to connect to database in load_admin_ranks(). Reverting to legacy system."
|
GLOB.diary << "Failed to connect to database in load_admin_ranks(). Reverting to legacy system."
|
||||||
config.admin_legacy_system = 1
|
config.admin_legacy_system = 1
|
||||||
load_admin_ranks()
|
load_admin_ranks()
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_load_admin_ranks = GLOB.dbcon.NewQuery("SELECT rank, flags FROM [format_table_name("admin_ranks")]")
|
var/datum/DBQuery/query_load_admin_ranks = SSdbcore.NewQuery("SELECT rank, flags FROM [format_table_name("admin_ranks")]")
|
||||||
if(!query_load_admin_ranks.Execute())
|
if(!query_load_admin_ranks.Execute())
|
||||||
return
|
return
|
||||||
while(query_load_admin_ranks.NextRow())
|
while(query_load_admin_ranks.NextRow())
|
||||||
@@ -200,14 +200,14 @@ GLOBAL_PROTECT(admin_ranks)
|
|||||||
world.SetConfig("APP/admin", ckey, "role=admin")
|
world.SetConfig("APP/admin", ckey, "role=admin")
|
||||||
D.associate(GLOB.directory[ckey]) //find the client for a ckey if they are connected and associate them with the new admin datum
|
D.associate(GLOB.directory[ckey]) //find the client for a ckey if they are connected and associate them with the new admin datum
|
||||||
else
|
else
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
log_world("Failed to connect to database in load_admins(). Reverting to legacy system.")
|
log_world("Failed to connect to database in load_admins(). Reverting to legacy system.")
|
||||||
GLOB.diary << "Failed to connect to database in load_admins(). Reverting to legacy system."
|
GLOB.diary << "Failed to connect to database in load_admins(). Reverting to legacy system."
|
||||||
config.admin_legacy_system = 1
|
config.admin_legacy_system = 1
|
||||||
load_admins()
|
load_admins()
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_load_admins = GLOB.dbcon.NewQuery("SELECT ckey, rank FROM [format_table_name("admin")]")
|
var/datum/DBQuery/query_load_admins = SSdbcore.NewQuery("SELECT ckey, rank FROM [format_table_name("admin")]")
|
||||||
if(!query_load_admins.Execute())
|
if(!query_load_admins.Execute())
|
||||||
return
|
return
|
||||||
while(query_load_admins.NextRow())
|
while(query_load_admins.NextRow())
|
||||||
@@ -373,10 +373,10 @@ GLOBAL_PROTECT(admin_ranks)
|
|||||||
edit_admin_permissions()
|
edit_admin_permissions()
|
||||||
|
|
||||||
/datum/admins/proc/updateranktodb(ckey,newrank)
|
/datum/admins/proc/updateranktodb(ckey,newrank)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
var/sql_ckey = sanitizeSQL(ckey)
|
var/sql_ckey = sanitizeSQL(ckey)
|
||||||
var/sql_admin_rank = sanitizeSQL(newrank)
|
var/sql_admin_rank = sanitizeSQL(newrank)
|
||||||
|
|
||||||
var/DBQuery/query_admin_rank_update = GLOB.dbcon.NewQuery("UPDATE [format_table_name("player")] SET lastadminrank = '[sql_admin_rank]' WHERE ckey = '[sql_ckey]'")
|
var/datum/DBQuery/query_admin_rank_update = SSdbcore.NewQuery("UPDATE [format_table_name("player")] SET lastadminrank = '[sql_admin_rank]' WHERE ckey = '[sql_ckey]'")
|
||||||
query_admin_rank_update.Execute()
|
query_admin_rank_update.Execute()
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
if(!M || !istype(M) || !M.ckey)
|
if(!M || !istype(M) || !M.ckey)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if(!M.client) //no cache. fallback to a DBQuery
|
if(!M.client) //no cache. fallback to a datum/DBQuery
|
||||||
var/DBQuery/query_jobban_check_ban = GLOB.dbcon.NewQuery("SELECT reason FROM [format_table_name("ban")] WHERE ckey = '[sanitizeSQL(M.ckey)]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned) AND job = '[sanitizeSQL(rank)]'")
|
var/datum/DBQuery/query_jobban_check_ban = SSdbcore.NewQuery("SELECT reason FROM [format_table_name("ban")] WHERE ckey = '[sanitizeSQL(M.ckey)]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned) AND job = '[sanitizeSQL(rank)]'")
|
||||||
if(!query_jobban_check_ban.warn_execute())
|
if(!query_jobban_check_ban.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_jobban_check_ban.NextRow())
|
if(query_jobban_check_ban.NextRow())
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
/proc/jobban_buildcache(client/C)
|
/proc/jobban_buildcache(client/C)
|
||||||
if(C && istype(C))
|
if(C && istype(C))
|
||||||
C.jobbancache = list()
|
C.jobbancache = list()
|
||||||
var/DBQuery/query_jobban_build_cache = GLOB.dbcon.NewQuery("SELECT job, reason FROM [format_table_name("ban")] WHERE ckey = '[sanitizeSQL(C.ckey)]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
|
var/datum/DBQuery/query_jobban_build_cache = SSdbcore.NewQuery("SELECT job, reason FROM [format_table_name("ban")] WHERE ckey = '[sanitizeSQL(C.ckey)]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
|
||||||
if(!query_jobban_build_cache.warn_execute())
|
if(!query_jobban_build_cache.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_jobban_build_cache.NextRow())
|
while(query_jobban_build_cache.NextRow())
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
set category = "Special Verbs"
|
set category = "Special Verbs"
|
||||||
if(!check_rights(R_PERMISSIONS))
|
if(!check_rights(R_PERMISSIONS))
|
||||||
return
|
return
|
||||||
if(!GLOB.dbcon.IsConnected())
|
if(!SSdbcore.IsConnected())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
var/returned = create_poll_function()
|
var/returned = create_poll_function()
|
||||||
if(returned)
|
if(returned)
|
||||||
var/DBQuery/query_check_option = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE pollid = [returned]")
|
var/datum/DBQuery/query_check_option = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE pollid = [returned]")
|
||||||
if(!query_check_option.warn_execute())
|
if(!query_check_option.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_check_option.NextRow())
|
if(query_check_option.NextRow())
|
||||||
var/DBQuery/query_log_get = GLOB.dbcon.NewQuery("SELECT polltype, question, adminonly FROM [format_table_name("poll_question")] WHERE id = [returned]")
|
var/datum/DBQuery/query_log_get = SSdbcore.NewQuery("SELECT polltype, question, adminonly FROM [format_table_name("poll_question")] WHERE id = [returned]")
|
||||||
if(!query_log_get.warn_execute())
|
if(!query_log_get.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_log_get.NextRow())
|
if(query_log_get.NextRow())
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
message_admins("[key_name_admin(usr)] has created a new server poll. Poll type: [polltype] - Admin Only: [adminonly ? "Yes" : "No"]<br>Question: [question]")
|
message_admins("[key_name_admin(usr)] has created a new server poll. Poll type: [polltype] - Admin Only: [adminonly ? "Yes" : "No"]<br>Question: [question]")
|
||||||
else
|
else
|
||||||
to_chat(src, "Poll question created without any options, poll will be deleted.")
|
to_chat(src, "Poll question created without any options, poll will be deleted.")
|
||||||
var/DBQuery/query_del_poll = GLOB.dbcon.NewQuery("DELETE FROM [format_table_name("poll_question")] WHERE id = [returned]")
|
var/datum/DBQuery/query_del_poll = SSdbcore.NewQuery("DELETE FROM [format_table_name("poll_question")] WHERE id = [returned]")
|
||||||
if(!query_del_poll.warn_execute())
|
if(!query_del_poll.warn_execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
if(!endtime)
|
if(!endtime)
|
||||||
return
|
return
|
||||||
endtime = sanitizeSQL(endtime)
|
endtime = sanitizeSQL(endtime)
|
||||||
var/DBQuery/query_validate_time = GLOB.dbcon.NewQuery("SELECT STR_TO_DATE('[endtime]','%Y-%c-%d %T')")
|
var/datum/DBQuery/query_validate_time = SSdbcore.NewQuery("SELECT STR_TO_DATE('[endtime]','%Y-%c-%d %T')")
|
||||||
if(!query_validate_time.warn_execute())
|
if(!query_validate_time.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_validate_time.NextRow())
|
if(query_validate_time.NextRow())
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
if(!endtime)
|
if(!endtime)
|
||||||
to_chat(src, "Datetime entered is invalid.")
|
to_chat(src, "Datetime entered is invalid.")
|
||||||
return
|
return
|
||||||
var/DBQuery/query_time_later = GLOB.dbcon.NewQuery("SELECT TIMESTAMP('[endtime]') < NOW()")
|
var/datum/DBQuery/query_time_later = SSdbcore.NewQuery("SELECT TIMESTAMP('[endtime]') < NOW()")
|
||||||
if(!query_time_later.warn_execute())
|
if(!query_time_later.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_time_later.NextRow())
|
if(query_time_later.NextRow())
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
if(!question)
|
if(!question)
|
||||||
return
|
return
|
||||||
question = sanitizeSQL(question)
|
question = sanitizeSQL(question)
|
||||||
var/DBQuery/query_polladd_question = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_question")] (polltype, starttime, endtime, question, adminonly, multiplechoiceoptions, createdby_ckey, createdby_ip, dontshow) VALUES ('[polltype]', '[starttime]', '[endtime]', '[question]', '[adminonly]', '[choice_amount]', '[sql_ckey]', INET_ATON('[address]'), '[dontshow]')")
|
var/datum/DBQuery/query_polladd_question = SSdbcore.NewQuery("INSERT INTO [format_table_name("poll_question")] (polltype, starttime, endtime, question, adminonly, multiplechoiceoptions, createdby_ckey, createdby_ip, dontshow) VALUES ('[polltype]', '[starttime]', '[endtime]', '[question]', '[adminonly]', '[choice_amount]', '[sql_ckey]', INET_ATON('[address]'), '[dontshow]')")
|
||||||
if(!query_polladd_question.warn_execute())
|
if(!query_polladd_question.warn_execute())
|
||||||
return
|
return
|
||||||
if(polltype == POLLTYPE_TEXT)
|
if(polltype == POLLTYPE_TEXT)
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
message_admins("[key_name_admin(usr)] has created a new server poll. Poll type: [polltype] - Admin Only: [adminonly ? "Yes" : "No"]<br>Question: [question]")
|
message_admins("[key_name_admin(usr)] has created a new server poll. Poll type: [polltype] - Admin Only: [adminonly ? "Yes" : "No"]<br>Question: [question]")
|
||||||
return
|
return
|
||||||
var/pollid = 0
|
var/pollid = 0
|
||||||
var/DBQuery/query_get_id = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE question = '[question]' AND starttime = '[starttime]' AND endtime = '[endtime]' AND createdby_ckey = '[sql_ckey]' AND createdby_ip = INET_ATON('[address]')")
|
var/datum/DBQuery/query_get_id = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE question = '[question]' AND starttime = '[starttime]' AND endtime = '[endtime]' AND createdby_ckey = '[sql_ckey]' AND createdby_ip = INET_ATON('[address]')")
|
||||||
if(!query_get_id.warn_execute())
|
if(!query_get_id.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_get_id.NextRow())
|
if(query_get_id.NextRow())
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
descmax = sanitizeSQL(descmax)
|
descmax = sanitizeSQL(descmax)
|
||||||
else if(descmax == null)
|
else if(descmax == null)
|
||||||
return pollid
|
return pollid
|
||||||
var/DBQuery/query_polladd_option = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_option")] (pollid, text, percentagecalc, minval, maxval, descmin, descmid, descmax) VALUES ('[pollid]', '[option]', '[percentagecalc]', '[minval]', '[maxval]', '[descmin]', '[descmid]', '[descmax]')")
|
var/datum/DBQuery/query_polladd_option = SSdbcore.NewQuery("INSERT INTO [format_table_name("poll_option")] (pollid, text, percentagecalc, minval, maxval, descmin, descmid, descmax) VALUES ('[pollid]', '[option]', '[percentagecalc]', '[minval]', '[maxval]', '[descmin]', '[descmid]', '[descmax]')")
|
||||||
if(!query_polladd_option.warn_execute())
|
if(!query_polladd_option.warn_execute())
|
||||||
return pollid
|
return pollid
|
||||||
switch(alert(" ",,"Add option","Finish", "Cancel"))
|
switch(alert(" ",,"Add option","Finish", "Cancel"))
|
||||||
|
|||||||
@@ -33,8 +33,8 @@
|
|||||||
cachedintel.cache = TRUE
|
cachedintel.cache = TRUE
|
||||||
return cachedintel
|
return cachedintel
|
||||||
|
|
||||||
if(GLOB.dbcon.Connect())
|
if(SSdbcore.Connect())
|
||||||
var/DBQuery/query_get_ip_intel = GLOB.dbcon.NewQuery({"
|
var/datum/DBQuery/query_get_ip_intel = SSdbcore.NewQuery({"
|
||||||
SELECT date, intel, TIMESTAMPDIFF(MINUTE,date,NOW())
|
SELECT date, intel, TIMESTAMPDIFF(MINUTE,date,NOW())
|
||||||
FROM [format_table_name("ipintel")]
|
FROM [format_table_name("ipintel")]
|
||||||
WHERE
|
WHERE
|
||||||
@@ -62,8 +62,8 @@
|
|||||||
res.intel = ip_intel_query(ip)
|
res.intel = ip_intel_query(ip)
|
||||||
if (updatecache && res.intel >= 0)
|
if (updatecache && res.intel >= 0)
|
||||||
SSipintel.cache[ip] = res
|
SSipintel.cache[ip] = res
|
||||||
if(GLOB.dbcon.Connect())
|
if(SSdbcore.Connect())
|
||||||
var/DBQuery/query_add_ip_intel = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("ipintel")] (ip, intel) VALUES (INET_ATON('[ip]'), [res.intel]) ON DUPLICATE KEY UPDATE intel = VALUES(intel), date = NOW()")
|
var/datum/DBQuery/query_add_ip_intel = SSdbcore.NewQuery("INSERT INTO [format_table_name("ipintel")] (ip, intel) VALUES (INET_ATON('[ip]'), [res.intel]) ON DUPLICATE KEY UPDATE intel = VALUES(intel), date = NOW()")
|
||||||
query_add_ip_intel.Execute()
|
query_add_ip_intel.Execute()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
if (!check_rights(R_PERMISSIONS))
|
if (!check_rights(R_PERMISSIONS))
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
if(!istext(adm_ckey) || !istext(new_rank))
|
if(!istext(adm_ckey) || !istext(new_rank))
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_get_admin = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("admin")] WHERE ckey = '[adm_ckey]'")
|
var/datum/DBQuery/query_get_admin = SSdbcore.NewQuery("SELECT id FROM [format_table_name("admin")] WHERE ckey = '[adm_ckey]'")
|
||||||
if(!query_get_admin.warn_execute())
|
if(!query_get_admin.warn_execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -86,19 +86,19 @@
|
|||||||
admin_id = text2num(query_get_admin.item[1])
|
admin_id = text2num(query_get_admin.item[1])
|
||||||
|
|
||||||
if(new_admin)
|
if(new_admin)
|
||||||
var/DBQuery/query_add_admin = GLOB.dbcon.NewQuery("INSERT INTO `[format_table_name("admin")]` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
|
var/datum/DBQuery/query_add_admin = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin")]` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
|
||||||
if(!query_add_admin.warn_execute())
|
if(!query_add_admin.warn_execute())
|
||||||
return
|
return
|
||||||
var/DBQuery/query_add_admin_log = GLOB.dbcon.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new admin [adm_ckey] to rank [new_rank]');")
|
var/datum/DBQuery/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 admin [adm_ckey] to rank [new_rank]');")
|
||||||
if(!query_add_admin_log.warn_execute())
|
if(!query_add_admin_log.warn_execute())
|
||||||
return
|
return
|
||||||
to_chat(usr, "<span class='adminnotice'>New admin added.</span>")
|
to_chat(usr, "<span class='adminnotice'>New admin added.</span>")
|
||||||
else
|
else
|
||||||
if(!isnull(admin_id) && isnum(admin_id))
|
if(!isnull(admin_id) && isnum(admin_id))
|
||||||
var/DBQuery/query_change_admin = GLOB.dbcon.NewQuery("UPDATE `[format_table_name("admin")]` SET rank = '[new_rank]' WHERE id = [admin_id]")
|
var/datum/DBQuery/query_change_admin = SSdbcore.NewQuery("UPDATE `[format_table_name("admin")]` SET rank = '[new_rank]' WHERE id = [admin_id]")
|
||||||
if(!query_change_admin.warn_execute())
|
if(!query_change_admin.warn_execute())
|
||||||
return
|
return
|
||||||
var/DBQuery/query_change_admin_log = GLOB.dbcon.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edited the rank of [adm_ckey] to [new_rank]');")
|
var/datum/DBQuery/query_change_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edited the rank of [adm_ckey] to [new_rank]');")
|
||||||
if(!query_change_admin_log.warn_execute())
|
if(!query_change_admin_log.warn_execute())
|
||||||
return
|
return
|
||||||
to_chat(usr, "<span class='adminnnotice'>Admin rank changed.</span>")
|
to_chat(usr, "<span class='adminnnotice'>Admin rank changed.</span>")
|
||||||
@@ -112,14 +112,14 @@
|
|||||||
if(check_rights(R_PERMISSIONS))
|
if(check_rights(R_PERMISSIONS))
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!adm_ckey || !istext(adm_ckey) || !isnum(new_permission))
|
if(!adm_ckey || !istext(adm_ckey) || !isnum(new_permission))
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_get_perms = GLOB.dbcon.NewQuery("SELECT id, flags FROM [format_table_name("admin")] WHERE ckey = '[adm_ckey]'")
|
var/datum/DBQuery/query_get_perms = SSdbcore.NewQuery("SELECT id, flags FROM [format_table_name("admin")] WHERE ckey = '[adm_ckey]'")
|
||||||
if(!query_get_perms.warn_execute())
|
if(!query_get_perms.warn_execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -130,8 +130,8 @@
|
|||||||
if(!admin_id)
|
if(!admin_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_change_perms = GLOB.dbcon.NewQuery("UPDATE `[format_table_name("admin")]` SET flags = [new_permission] WHERE id = [admin_id]")
|
var/datum/DBQuery/query_change_perms = SSdbcore.NewQuery("UPDATE `[format_table_name("admin")]` SET flags = [new_permission] WHERE id = [admin_id]")
|
||||||
if(!query_change_perms.warn_execute())
|
if(!query_change_perms.warn_execute())
|
||||||
return
|
return
|
||||||
var/DBQuery/query_change_perms_log = GLOB.dbcon.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edit permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
|
var/datum/DBQuery/query_change_perms_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edit permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
|
||||||
query_change_perms_log.warn_execute()
|
query_change_perms_log.warn_execute()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/proc/create_message(type, target_ckey, admin_ckey, text, timestamp, server, secret, logged = 1, browse)
|
/proc/create_message(type, target_ckey, admin_ckey, text, timestamp, server, secret, logged = 1, browse)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
if(!type)
|
if(!type)
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
if(!new_ckey)
|
if(!new_ckey)
|
||||||
return
|
return
|
||||||
new_ckey = sanitizeSQL(new_ckey)
|
new_ckey = sanitizeSQL(new_ckey)
|
||||||
var/DBQuery/query_find_ckey = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE ckey = '[new_ckey]'")
|
var/datum/DBQuery/query_find_ckey = SSdbcore.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE ckey = '[new_ckey]'")
|
||||||
if(!query_find_ckey.warn_execute())
|
if(!query_find_ckey.warn_execute())
|
||||||
return
|
return
|
||||||
if(!query_find_ckey.NextRow())
|
if(!query_find_ckey.NextRow())
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
secret = 0
|
secret = 0
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
var/DBQuery/query_create_message = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', '[secret]')")
|
var/datum/DBQuery/query_create_message = SSdbcore.NewQuery("INSERT INTO [format_table_name("messages")] (type, targetckey, adminckey, text, timestamp, server, secret) VALUES ('[type]', '[target_ckey]', '[admin_ckey]', '[text]', '[timestamp]', '[server]', '[secret]')")
|
||||||
if(!query_create_message.warn_execute())
|
if(!query_create_message.warn_execute())
|
||||||
return
|
return
|
||||||
if(logged)
|
if(logged)
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
browse_messages(target_ckey = target_ckey)
|
browse_messages(target_ckey = target_ckey)
|
||||||
|
|
||||||
/proc/delete_message(message_id, logged = 1, browse)
|
/proc/delete_message(message_id, logged = 1, browse)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
message_id = text2num(message_id)
|
message_id = text2num(message_id)
|
||||||
@@ -65,14 +65,14 @@
|
|||||||
var/type
|
var/type
|
||||||
var/target_ckey
|
var/target_ckey
|
||||||
var/text
|
var/text
|
||||||
var/DBQuery/query_find_del_message = GLOB.dbcon.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
|
var/datum/DBQuery/query_find_del_message = SSdbcore.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
|
||||||
if(!query_find_del_message.warn_execute())
|
if(!query_find_del_message.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_find_del_message.NextRow())
|
if(query_find_del_message.NextRow())
|
||||||
type = query_find_del_message.item[1]
|
type = query_find_del_message.item[1]
|
||||||
target_ckey = query_find_del_message.item[2]
|
target_ckey = query_find_del_message.item[2]
|
||||||
text = query_find_del_message.item[4]
|
text = query_find_del_message.item[4]
|
||||||
var/DBQuery/query_del_message = GLOB.dbcon.NewQuery("DELETE FROM [format_table_name("messages")] WHERE id = [message_id]")
|
var/datum/DBQuery/query_del_message = SSdbcore.NewQuery("DELETE FROM [format_table_name("messages")] WHERE id = [message_id]")
|
||||||
if(!query_del_message.warn_execute())
|
if(!query_del_message.warn_execute())
|
||||||
return
|
return
|
||||||
if(logged)
|
if(logged)
|
||||||
@@ -84,13 +84,13 @@
|
|||||||
browse_messages(target_ckey = target_ckey)
|
browse_messages(target_ckey = target_ckey)
|
||||||
|
|
||||||
/proc/edit_message(message_id, browse)
|
/proc/edit_message(message_id, browse)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
message_id = text2num(message_id)
|
message_id = text2num(message_id)
|
||||||
if(!message_id)
|
if(!message_id)
|
||||||
return
|
return
|
||||||
var/DBQuery/query_find_edit_message = GLOB.dbcon.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
|
var/datum/DBQuery/query_find_edit_message = SSdbcore.NewQuery("SELECT type, targetckey, adminckey, text FROM [format_table_name("messages")] WHERE id = [message_id]")
|
||||||
if(!query_find_edit_message.warn_execute())
|
if(!query_find_edit_message.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_find_edit_message.NextRow())
|
if(query_find_edit_message.NextRow())
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
return
|
return
|
||||||
new_text = sanitizeSQL(new_text)
|
new_text = sanitizeSQL(new_text)
|
||||||
var/edit_text = sanitizeSQL("Edited by [editor_ckey] on [SQLtime()] from<br>[old_text]<br>to<br>[new_text]<hr>")
|
var/edit_text = sanitizeSQL("Edited by [editor_ckey] on [SQLtime()] from<br>[old_text]<br>to<br>[new_text]<hr>")
|
||||||
var/DBQuery/query_edit_message = GLOB.dbcon.NewQuery("UPDATE [format_table_name("messages")] SET text = '[new_text]', lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
|
var/datum/DBQuery/query_edit_message = SSdbcore.NewQuery("UPDATE [format_table_name("messages")] SET text = '[new_text]', lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
|
||||||
if(!query_edit_message.warn_execute())
|
if(!query_edit_message.warn_execute())
|
||||||
return
|
return
|
||||||
log_admin_private("[key_name(usr)] has edited a [type] [(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_ckey]" : ""] made by [admin_ckey] from [old_text] to [new_text]")
|
log_admin_private("[key_name(usr)] has edited a [type] [(type == "note" || type == "message" || type == "watchlist entry") ? " for [target_ckey]" : ""] made by [admin_ckey] from [old_text] to [new_text]")
|
||||||
@@ -115,13 +115,13 @@
|
|||||||
browse_messages(target_ckey = target_ckey)
|
browse_messages(target_ckey = target_ckey)
|
||||||
|
|
||||||
/proc/toggle_message_secrecy(message_id)
|
/proc/toggle_message_secrecy(message_id)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
message_id = text2num(message_id)
|
message_id = text2num(message_id)
|
||||||
if(!message_id)
|
if(!message_id)
|
||||||
return
|
return
|
||||||
var/DBQuery/query_find_message_secret = GLOB.dbcon.NewQuery("SELECT type, targetckey, adminckey, secret FROM [format_table_name("messages")] WHERE id = [message_id]")
|
var/datum/DBQuery/query_find_message_secret = SSdbcore.NewQuery("SELECT type, targetckey, adminckey, secret FROM [format_table_name("messages")] WHERE id = [message_id]")
|
||||||
if(!query_find_message_secret.warn_execute())
|
if(!query_find_message_secret.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_find_message_secret.NextRow())
|
if(query_find_message_secret.NextRow())
|
||||||
@@ -131,7 +131,7 @@
|
|||||||
var/secret = text2num(query_find_message_secret.item[4])
|
var/secret = text2num(query_find_message_secret.item[4])
|
||||||
var/editor_ckey = sanitizeSQL(usr.ckey)
|
var/editor_ckey = sanitizeSQL(usr.ckey)
|
||||||
var/edit_text = "Made [secret ? "not secret" : "secret"] by [editor_ckey] on [SQLtime()]<hr>"
|
var/edit_text = "Made [secret ? "not secret" : "secret"] by [editor_ckey] on [SQLtime()]<hr>"
|
||||||
var/DBQuery/query_message_secret = GLOB.dbcon.NewQuery("UPDATE [format_table_name("messages")] SET secret = NOT secret, lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
|
var/datum/DBQuery/query_message_secret = SSdbcore.NewQuery("UPDATE [format_table_name("messages")] SET secret = NOT secret, lasteditor = '[editor_ckey]', edits = CONCAT(IFNULL(edits,''),'[edit_text]') WHERE id = [message_id]")
|
||||||
if(!query_message_secret.warn_execute())
|
if(!query_message_secret.warn_execute())
|
||||||
return
|
return
|
||||||
log_admin_private("[key_name(usr)] has toggled [target_ckey]'s [type] made by [admin_ckey] to [secret ? "not secret" : "secret"]")
|
log_admin_private("[key_name(usr)] has toggled [target_ckey]'s [type] made by [admin_ckey] to [secret ? "not secret" : "secret"]")
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
browse_messages(target_ckey = target_ckey)
|
browse_messages(target_ckey = target_ckey)
|
||||||
|
|
||||||
/proc/browse_messages(type, target_ckey, index, linkless = 0, filter)
|
/proc/browse_messages(type, target_ckey, index, linkless = 0, filter)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
var/output
|
var/output
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
else
|
else
|
||||||
output += "|<a href='?_src_=holder;showwatchfilter=1'>\[Filter offline clients\]</a></center>"
|
output += "|<a href='?_src_=holder;showwatchfilter=1'>\[Filter offline clients\]</a></center>"
|
||||||
output += ruler
|
output += ruler
|
||||||
var/DBQuery/query_get_type_messages = GLOB.dbcon.NewQuery("SELECT id, targetckey, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'")
|
var/datum/DBQuery/query_get_type_messages = SSdbcore.NewQuery("SELECT id, targetckey, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'")
|
||||||
if(!query_get_type_messages.warn_execute())
|
if(!query_get_type_messages.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_get_type_messages.NextRow())
|
while(query_get_type_messages.NextRow())
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
output += "<br>[text]<hr style='background:#000000; border:0; height:1px'>"
|
output += "<br>[text]<hr style='background:#000000; border:0; height:1px'>"
|
||||||
if(target_ckey)
|
if(target_ckey)
|
||||||
target_ckey = sanitizeSQL(target_ckey)
|
target_ckey = sanitizeSQL(target_ckey)
|
||||||
var/DBQuery/query_get_messages = GLOB.dbcon.NewQuery("SELECT type, secret, id, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey = '[target_ckey]' ORDER BY timestamp DESC")
|
var/datum/DBQuery/query_get_messages = SSdbcore.NewQuery("SELECT type, secret, id, adminckey, text, timestamp, server, lasteditor FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey = '[target_ckey]' ORDER BY timestamp DESC")
|
||||||
if(!query_get_messages.warn_execute())
|
if(!query_get_messages.warn_execute())
|
||||||
return
|
return
|
||||||
var/messagedata
|
var/messagedata
|
||||||
@@ -265,7 +265,7 @@
|
|||||||
search = "^\[^\[:alpha:\]\]"
|
search = "^\[^\[:alpha:\]\]"
|
||||||
else
|
else
|
||||||
search = "^[index]"
|
search = "^[index]"
|
||||||
var/DBQuery/query_list_messages = GLOB.dbcon.NewQuery("SELECT DISTINCT targetckey FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey REGEXP '[search]' ORDER BY targetckey")
|
var/datum/DBQuery/query_list_messages = SSdbcore.NewQuery("SELECT DISTINCT targetckey FROM [format_table_name("messages")] WHERE type <> 'memo' AND targetckey REGEXP '[search]' ORDER BY targetckey")
|
||||||
if(!query_list_messages.warn_execute())
|
if(!query_list_messages.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_list_messages.NextRow())
|
while(query_list_messages.NextRow())
|
||||||
@@ -277,7 +277,7 @@
|
|||||||
usr << browse(output, "window=browse_messages;size=900x500")
|
usr << browse(output, "window=browse_messages;size=900x500")
|
||||||
|
|
||||||
proc/get_message_output(type, target_ckey)
|
proc/get_message_output(type, target_ckey)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
if(!type)
|
if(!type)
|
||||||
@@ -288,7 +288,7 @@ proc/get_message_output(type, target_ckey)
|
|||||||
var/query = "SELECT id, adminckey, text, timestamp, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'"
|
var/query = "SELECT id, adminckey, text, timestamp, lasteditor FROM [format_table_name("messages")] WHERE type = '[type]'"
|
||||||
if(type == "message" || type == "watchlist entry")
|
if(type == "message" || type == "watchlist entry")
|
||||||
query += " AND targetckey = '[target_ckey]'"
|
query += " AND targetckey = '[target_ckey]'"
|
||||||
var/DBQuery/query_get_message_output = GLOB.dbcon.NewQuery(query)
|
var/datum/DBQuery/query_get_message_output = SSdbcore.NewQuery(query)
|
||||||
if(!query_get_message_output.warn_execute())
|
if(!query_get_message_output.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_get_message_output.NextRow())
|
while(query_get_message_output.NextRow())
|
||||||
@@ -301,7 +301,7 @@ proc/get_message_output(type, target_ckey)
|
|||||||
if("message")
|
if("message")
|
||||||
output += "<font color='red' size='3'><b>Admin message left by <span class='prefix'>[admin_ckey]</span> on [timestamp]</b></font>"
|
output += "<font color='red' size='3'><b>Admin message left by <span class='prefix'>[admin_ckey]</span> on [timestamp]</b></font>"
|
||||||
output += "<br><font color='red'>[text]</font><br>"
|
output += "<br><font color='red'>[text]</font><br>"
|
||||||
var/DBQuery/query_message_read = GLOB.dbcon.NewQuery("UPDATE [format_table_name("messages")] SET type = 'message sent' WHERE id = [message_id]")
|
var/datum/DBQuery/query_message_read = SSdbcore.NewQuery("UPDATE [format_table_name("messages")] SET type = 'message sent' WHERE id = [message_id]")
|
||||||
if(!query_message_read.warn_execute())
|
if(!query_message_read.warn_execute())
|
||||||
return
|
return
|
||||||
if("watchlist entry")
|
if("watchlist entry")
|
||||||
@@ -333,7 +333,7 @@ proc/get_message_output(type, target_ckey)
|
|||||||
var/timestamp = note.group[1]
|
var/timestamp = note.group[1]
|
||||||
notetext = note.group[2]
|
notetext = note.group[2]
|
||||||
var/admin_ckey = note.group[3]
|
var/admin_ckey = note.group[3]
|
||||||
var/DBQuery/query_convert_time = GLOB.dbcon.NewQuery("SELECT ADDTIME(STR_TO_DATE('[timestamp]','%d-%b-%Y'), '0')")
|
var/datum/DBQuery/query_convert_time = SSdbcore.NewQuery("SELECT ADDTIME(STR_TO_DATE('[timestamp]','%d-%b-%Y'), '0')")
|
||||||
if(!query_convert_time.Execute())
|
if(!query_convert_time.Execute())
|
||||||
return
|
return
|
||||||
if(query_convert_time.NextRow())
|
if(query_convert_time.NextRow())
|
||||||
|
|||||||
@@ -1109,7 +1109,7 @@
|
|||||||
|
|
||||||
else if(href_list["messageedits"])
|
else if(href_list["messageedits"])
|
||||||
var/message_id = sanitizeSQL("[href_list["messageedits"]]")
|
var/message_id = sanitizeSQL("[href_list["messageedits"]]")
|
||||||
var/DBQuery/query_get_message_edits = GLOB.dbcon.NewQuery("SELECT edits FROM [format_table_name("messages")] WHERE id = '[message_id]'")
|
var/datum/DBQuery/query_get_message_edits = SSdbcore.NewQuery("SELECT edits FROM [format_table_name("messages")] WHERE id = '[message_id]'")
|
||||||
if(!query_get_message_edits.warn_execute())
|
if(!query_get_message_edits.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_get_message_edits.NextRow())
|
if(query_get_message_edits.NextRow())
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
log_admin("[key_name(usr)] has toggled the Panic Bunker, it is now [(config.panic_bunker?"on":"off")]")
|
log_admin("[key_name(usr)] has toggled the Panic Bunker, it is now [(config.panic_bunker?"on":"off")]")
|
||||||
message_admins("[key_name_admin(usr)] has toggled the Panic Bunker, it is now [(config.panic_bunker?"enabled":"disabled")].")
|
message_admins("[key_name_admin(usr)] has toggled the Panic Bunker, it is now [(config.panic_bunker?"enabled":"disabled")].")
|
||||||
if (config.panic_bunker && (!GLOB.dbcon || !GLOB.dbcon.IsConnected()))
|
if (config.panic_bunker && (!SSdbcore || !SSdbcore.IsConnected()))
|
||||||
message_admins("The Database is not connected! Panic bunker will not work until the connection is reestablished.")
|
message_admins("The Database is not connected! Panic bunker will not work until the connection is reestablished.")
|
||||||
feedback_add_details("admin_toggle","Toggle Panic Bunker|[config.panic_bunker]") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
feedback_add_details("admin_toggle","Toggle Panic Bunker|[config.panic_bunker]") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
to_chat(usr, "<span class='adminnotice'>The Database is not enabled!</span>")
|
to_chat(usr, "<span class='adminnotice'>The Database is not enabled!</span>")
|
||||||
return
|
return
|
||||||
|
|
||||||
if (GLOB.dbcon && GLOB.dbcon.IsConnected())
|
if (SSdbcore && SSdbcore.IsConnected())
|
||||||
if (!check_rights(R_DEBUG,0))
|
if (!check_rights(R_DEBUG,0))
|
||||||
alert("The database is already connected! (Only those with +debug can force a reconnection)", "The database is already connected!")
|
alert("The database is already connected! (Only those with +debug can force a reconnection)", "The database is already connected!")
|
||||||
return
|
return
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
if (reconnect != "Force Reconnect")
|
if (reconnect != "Force Reconnect")
|
||||||
return
|
return
|
||||||
|
|
||||||
GLOB.dbcon.Disconnect()
|
SSdbcore.Disconnect()
|
||||||
log_admin("[key_name(usr)] has forced the database to disconnect")
|
log_admin("[key_name(usr)] has forced the database to disconnect")
|
||||||
message_admins("[key_name_admin(usr)] has <b>forced</b> the database to disconnect!")
|
message_admins("[key_name_admin(usr)] has <b>forced</b> the database to disconnect!")
|
||||||
feedback_add_details("admin_verb","Force Reestablished Database Connection") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
feedback_add_details("admin_verb","Force Reestablished Database Connection") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
message_admins("[key_name_admin(usr)] is attempting to re-established the DB Connection")
|
message_admins("[key_name_admin(usr)] is attempting to re-established the DB Connection")
|
||||||
feedback_add_details("admin_verb","Reestablished Database Connection") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
feedback_add_details("admin_verb","Reestablished Database Connection") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
|
|
||||||
GLOB.dbcon.failed_connections = 0
|
SSdbcore.failed_connections = 0
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
message_admins("Database connection failed: " + GLOB.dbcon.ErrorMsg())
|
message_admins("Database connection failed: " + SSdbcore.ErrorMsg())
|
||||||
else
|
else
|
||||||
message_admins("Database connection re-established")
|
message_admins("Database connection re-established")
|
||||||
@@ -292,7 +292,7 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
else if (isnum(player_age) && player_age < config.notify_new_player_age)
|
else if (isnum(player_age) && player_age < config.notify_new_player_age)
|
||||||
message_admins("New user: [key_name_admin(src)] just connected with an age of [player_age] day[(player_age==1?"":"s")]")
|
message_admins("New user: [key_name_admin(src)] just connected with an age of [player_age] day[(player_age==1?"":"s")]")
|
||||||
|
|
||||||
if(!IsGuestKey(key) && GLOB.dbcon.IsConnected())
|
if(!IsGuestKey(key) && SSdbcore.IsConnected())
|
||||||
findJoinDate()
|
findJoinDate()
|
||||||
|
|
||||||
sync_client_with_db(tdata)
|
sync_client_with_db(tdata)
|
||||||
@@ -354,12 +354,12 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
if (IsGuestKey(src.key))
|
if (IsGuestKey(src.key))
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
|
|
||||||
var/sql_ckey = sanitizeSQL(src.ckey)
|
var/sql_ckey = sanitizeSQL(src.ckey)
|
||||||
|
|
||||||
var/DBQuery/query_get_client_age = GLOB.dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'")
|
var/datum/DBQuery/query_get_client_age = SSdbcore.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'")
|
||||||
if(!query_get_client_age.Execute())
|
if(!query_get_client_age.Execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -375,18 +375,18 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
if (IsGuestKey(src.key))
|
if (IsGuestKey(src.key))
|
||||||
return
|
return
|
||||||
|
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
|
|
||||||
var/sql_ckey = sanitizeSQL(ckey)
|
var/sql_ckey = sanitizeSQL(ckey)
|
||||||
|
|
||||||
var/DBQuery/query_get_ip = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE ip = INET_ATON('[address]') AND ckey != '[sql_ckey]'")
|
var/datum/DBQuery/query_get_ip = SSdbcore.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE ip = INET_ATON('[address]') AND ckey != '[sql_ckey]'")
|
||||||
query_get_ip.Execute()
|
query_get_ip.Execute()
|
||||||
related_accounts_ip = ""
|
related_accounts_ip = ""
|
||||||
while(query_get_ip.NextRow())
|
while(query_get_ip.NextRow())
|
||||||
related_accounts_ip += "[query_get_ip.item[1]], "
|
related_accounts_ip += "[query_get_ip.item[1]], "
|
||||||
|
|
||||||
var/DBQuery/query_get_cid = GLOB.dbcon.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE computerid = '[computer_id]' AND ckey != '[sql_ckey]'")
|
var/datum/DBQuery/query_get_cid = SSdbcore.NewQuery("SELECT ckey FROM [format_table_name("player")] WHERE computerid = '[computer_id]' AND ckey != '[sql_ckey]'")
|
||||||
if(!query_get_cid.Execute())
|
if(!query_get_cid.Execute())
|
||||||
return
|
return
|
||||||
related_accounts_cid = ""
|
related_accounts_cid = ""
|
||||||
@@ -405,13 +405,13 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
var/sql_admin_rank = sanitizeSQL(admin_rank)
|
var/sql_admin_rank = sanitizeSQL(admin_rank)
|
||||||
|
|
||||||
|
|
||||||
var/DBQuery/query_log_player = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("player")] (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]') ON DUPLICATE KEY UPDATE lastseen = VALUES(lastseen), ip = VALUES(ip), computerid = VALUES(computerid), lastadminrank = VALUES(lastadminrank)")
|
var/datum/DBQuery/query_log_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]') ON DUPLICATE KEY UPDATE lastseen = VALUES(lastseen), ip = VALUES(ip), computerid = VALUES(computerid), lastadminrank = VALUES(lastadminrank)")
|
||||||
if(!query_log_player.Execute())
|
if(!query_log_player.Execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
//Logging player access
|
//Logging player access
|
||||||
|
|
||||||
var/DBQuery/query_log_connection = GLOB.dbcon.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`server_ip`,`server_port`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),INET_ATON('[world.internet_address]'),'[world.port]','[sql_ckey]',INET_ATON('[sql_ip]'),'[sql_computerid]')")
|
var/datum/DBQuery/query_log_connection = SSdbcore.NewQuery("INSERT INTO `[format_table_name("connection_log")]` (`id`,`datetime`,`server_ip`,`server_port`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),INET_ATON('[world.internet_address]'),'[world.port]','[sql_ckey]',INET_ATON('[sql_ip]'),'[sql_computerid]')")
|
||||||
query_log_connection.Execute()
|
query_log_connection.Execute()
|
||||||
|
|
||||||
/client/proc/check_randomizer(topic)
|
/client/proc/check_randomizer(topic)
|
||||||
@@ -467,7 +467,7 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
cidcheck -= ckey
|
cidcheck -= ckey
|
||||||
else
|
else
|
||||||
var/sql_ckey = sanitizeSQL(ckey)
|
var/sql_ckey = sanitizeSQL(ckey)
|
||||||
var/DBQuery/query_cidcheck = GLOB.dbcon.NewQuery("SELECT computerid FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'")
|
var/datum/DBQuery/query_cidcheck = SSdbcore.NewQuery("SELECT computerid FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'")
|
||||||
query_cidcheck.Execute()
|
query_cidcheck.Execute()
|
||||||
|
|
||||||
var/lastcid
|
var/lastcid
|
||||||
@@ -495,13 +495,13 @@ GLOBAL_LIST(external_rsc_urls)
|
|||||||
var/const/adminckey = "CID-Error"
|
var/const/adminckey = "CID-Error"
|
||||||
var/sql_ckey = sanitizeSQL(ckey)
|
var/sql_ckey = sanitizeSQL(ckey)
|
||||||
//check to see if we noted them in the last day.
|
//check to see if we noted them in the last day.
|
||||||
var/DBQuery/query_get_notes = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("messages")] WHERE type = 'note' AND targetckey = '[sql_ckey]' AND adminckey = '[adminckey]' AND timestamp + INTERVAL 1 DAY < NOW()")
|
var/datum/DBQuery/query_get_notes = SSdbcore.NewQuery("SELECT id FROM [format_table_name("messages")] WHERE type = 'note' AND targetckey = '[sql_ckey]' AND adminckey = '[adminckey]' AND timestamp + INTERVAL 1 DAY < NOW()")
|
||||||
if(!query_get_notes.Execute())
|
if(!query_get_notes.Execute())
|
||||||
return
|
return
|
||||||
if(query_get_notes.NextRow())
|
if(query_get_notes.NextRow())
|
||||||
return
|
return
|
||||||
//regardless of above, make sure their last note is not from us, as no point in repeating the same note over and over.
|
//regardless of above, make sure their last note is not from us, as no point in repeating the same note over and over.
|
||||||
query_get_notes = GLOB.dbcon.NewQuery("SELECT adminckey FROM [format_table_name("messages")] WHERE targetckey = '[sql_ckey]' ORDER BY timestamp DESC LIMIT 1")
|
query_get_notes = SSdbcore.NewQuery("SELECT adminckey FROM [format_table_name("messages")] WHERE targetckey = '[sql_ckey]' ORDER BY timestamp DESC LIMIT 1")
|
||||||
if(!query_get_notes.Execute())
|
if(!query_get_notes.Execute())
|
||||||
return
|
return
|
||||||
if(query_get_notes.NextRow())
|
if(query_get_notes.NextRow())
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
|||||||
if(href_list["jobbancheck"])
|
if(href_list["jobbancheck"])
|
||||||
var/job = sanitizeSQL(href_list["jobbancheck"])
|
var/job = sanitizeSQL(href_list["jobbancheck"])
|
||||||
var/sql_ckey = sanitizeSQL(user.ckey)
|
var/sql_ckey = sanitizeSQL(user.ckey)
|
||||||
var/DBQuery/query_get_jobban = GLOB.dbcon.NewQuery("SELECT reason, bantime, duration, expiration_time, a_ckey FROM [format_table_name("ban")] WHERE ckey = '[sql_ckey]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned) AND job = '[job]'")
|
var/datum/DBQuery/query_get_jobban = SSdbcore.NewQuery("SELECT reason, bantime, duration, expiration_time, a_ckey FROM [format_table_name("ban")] WHERE ckey = '[sql_ckey]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned) AND job = '[job]'")
|
||||||
if(!query_get_jobban.warn_execute())
|
if(!query_get_jobban.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_get_jobban.NextRow())
|
if(query_get_jobban.NextRow())
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
dat += "<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>"
|
dat += "<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>"
|
||||||
dat += "<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"
|
dat += "<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"
|
||||||
if(1)
|
if(1)
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font><BR>"
|
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font><BR>"
|
||||||
else if(!SQLquery)
|
else if(!SQLquery)
|
||||||
dat += "<font color=red><b>ERROR</b>: Malformed search request. Please contact your system administrator for assistance.</font><BR>"
|
dat += "<font color=red><b>ERROR</b>: Malformed search request. Please contact your system administrator for assistance.</font><BR>"
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
dat += "<table>"
|
dat += "<table>"
|
||||||
dat += "<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td>SS<sup>13</sup>BN</td></tr>"
|
dat += "<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td>SS<sup>13</sup>BN</td></tr>"
|
||||||
|
|
||||||
var/DBQuery/query_library_list_books = GLOB.dbcon.NewQuery(SQLquery)
|
var/datum/DBQuery/query_library_list_books = SSdbcore.NewQuery(SQLquery)
|
||||||
if(!query_library_list_books.Execute())
|
if(!query_library_list_books.Execute())
|
||||||
dat += "<font color=red><b>ERROR</b>: Unable to retrieve book listings. Please contact your system administrator for assistance.</font><BR>"
|
dat += "<font color=red><b>ERROR</b>: Unable to retrieve book listings. Please contact your system administrator for assistance.</font><BR>"
|
||||||
while(query_library_list_books.NextRow())
|
while(query_library_list_books.NextRow())
|
||||||
@@ -134,10 +134,10 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
|
|||||||
/proc/load_library_db_to_cache()
|
/proc/load_library_db_to_cache()
|
||||||
if(GLOB.cachedbooks)
|
if(GLOB.cachedbooks)
|
||||||
return
|
return
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
GLOB.cachedbooks = list()
|
GLOB.cachedbooks = list()
|
||||||
var/DBQuery/query_library_cache = GLOB.dbcon.NewQuery("SELECT id, author, title, category FROM [format_table_name("library")] WHERE isnull(deleted)")
|
var/datum/DBQuery/query_library_cache = SSdbcore.NewQuery("SELECT id, author, title, category FROM [format_table_name("library")] WHERE isnull(deleted)")
|
||||||
if(!query_library_cache.Execute())
|
if(!query_library_cache.Execute())
|
||||||
return
|
return
|
||||||
while(query_library_cache.NextRow())
|
while(query_library_cache.NextRow())
|
||||||
@@ -411,7 +411,7 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
|
|||||||
if(scanner.cache)
|
if(scanner.cache)
|
||||||
var/choice = input("Are you certain you wish to upload this title to the Archive?") in list("Confirm", "Abort")
|
var/choice = input("Are you certain you wish to upload this title to the Archive?") in list("Confirm", "Abort")
|
||||||
if(choice == "Confirm")
|
if(choice == "Confirm")
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
alert("Connection to Archive has been severed. Aborting.")
|
alert("Connection to Archive has been severed. Aborting.")
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
|
|||||||
var/sqlauthor = sanitizeSQL(scanner.cache.author)
|
var/sqlauthor = sanitizeSQL(scanner.cache.author)
|
||||||
var/sqlcontent = sanitizeSQL(scanner.cache.dat)
|
var/sqlcontent = sanitizeSQL(scanner.cache.dat)
|
||||||
var/sqlcategory = sanitizeSQL(upload_category)
|
var/sqlcategory = sanitizeSQL(upload_category)
|
||||||
var/DBQuery/query_library_upload = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("library")] (author, title, content, category, ckey, datetime) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', '[usr.ckey]', Now())")
|
var/datum/DBQuery/query_library_upload = SSdbcore.NewQuery("INSERT INTO [format_table_name("library")] (author, title, content, category, ckey, datetime) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', '[usr.ckey]', Now())")
|
||||||
if(!query_library_upload.Execute())
|
if(!query_library_upload.Execute())
|
||||||
alert("Database error encountered uploading to Archive")
|
alert("Database error encountered uploading to Archive")
|
||||||
return
|
return
|
||||||
@@ -449,13 +449,13 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
|
|||||||
|
|
||||||
if(href_list["targetid"])
|
if(href_list["targetid"])
|
||||||
var/sqlid = sanitizeSQL(href_list["targetid"])
|
var/sqlid = sanitizeSQL(href_list["targetid"])
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
alert("Connection to Archive has been severed. Aborting.")
|
alert("Connection to Archive has been severed. Aborting.")
|
||||||
if(cooldown > world.time)
|
if(cooldown > world.time)
|
||||||
say("Printer unavailable. Please allow a short time before attempting to print.")
|
say("Printer unavailable. Please allow a short time before attempting to print.")
|
||||||
else
|
else
|
||||||
cooldown = world.time + PRINTER_COOLDOWN
|
cooldown = world.time + PRINTER_COOLDOWN
|
||||||
var/DBQuery/query_library_print = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("library")] WHERE id=[sqlid] AND isnull(deleted)")
|
var/datum/DBQuery/query_library_print = SSdbcore.NewQuery("SELECT * FROM [format_table_name("library")] WHERE id=[sqlid] AND isnull(deleted)")
|
||||||
if(!query_library_print.Execute())
|
if(!query_library_print.Execute())
|
||||||
say("PRINTER ERROR! Failed to print document (0x0000000F)")
|
say("PRINTER ERROR! Failed to print document (0x0000000F)")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
. = list()
|
. = list()
|
||||||
if(!isnum(amount) || amount<1)
|
if(!isnum(amount) || amount<1)
|
||||||
return
|
return
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
if(fail_loud || prob(5))
|
if(fail_loud || prob(5))
|
||||||
var/obj/item/weapon/paper/P = new(location)
|
var/obj/item/weapon/paper/P = new(location)
|
||||||
P.info = "There once was a book from Nantucket<br>But the database failed us, so f*$! it.<br>I tried to be good to you<br>Now this is an I.O.U<br>If you're feeling entitled, well, stuff it!<br><br><font color='gray'>~</font>"
|
P.info = "There once was a book from Nantucket<br>But the database failed us, so f*$! it.<br>I tried to be good to you<br>Now this is an I.O.U<br>If you're feeling entitled, well, stuff it!<br><br><font color='gray'>~</font>"
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
if(prob(25))
|
if(prob(25))
|
||||||
category = null
|
category = null
|
||||||
var/c = category? " AND category='[sanitizeSQL(category)]'" :""
|
var/c = category? " AND category='[sanitizeSQL(category)]'" :""
|
||||||
var/DBQuery/query_get_random_books = GLOB.dbcon.NewQuery("SELECT * FROM [format_table_name("library")] WHERE isnull(deleted)[c] GROUP BY title ORDER BY rand() LIMIT [amount];") // isdeleted copyright (c) not me
|
var/datum/DBQuery/query_get_random_books = SSdbcore.NewQuery("SELECT * FROM [format_table_name("library")] WHERE isnull(deleted)[c] GROUP BY title ORDER BY rand() LIMIT [amount];") // isdeleted copyright (c) not me
|
||||||
if(query_get_random_books.Execute())
|
if(query_get_random_books.Execute())
|
||||||
while(query_get_random_books.NextRow())
|
while(query_get_random_books.NextRow())
|
||||||
var/obj/item/weapon/book/B = new(location)
|
var/obj/item/weapon/book/B = new(location)
|
||||||
|
|||||||
@@ -48,11 +48,11 @@
|
|||||||
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
|
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
|
||||||
|
|
||||||
if(!IsGuestKey(src.key))
|
if(!IsGuestKey(src.key))
|
||||||
if (GLOB.dbcon.Connect())
|
if (SSdbcore.Connect())
|
||||||
var/isadmin = 0
|
var/isadmin = 0
|
||||||
if(src.client && src.client.holder)
|
if(src.client && src.client.holder)
|
||||||
isadmin = 1
|
isadmin = 1
|
||||||
var/DBQuery/query_get_new_polls = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
|
var/datum/DBQuery/query_get_new_polls = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_question")] WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM [format_table_name("poll_vote")] WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM [format_table_name("poll_textreply")] WHERE ckey = \"[ckey]\")")
|
||||||
if(!query_get_new_polls.Execute())
|
if(!query_get_new_polls.Execute())
|
||||||
return
|
return
|
||||||
var/newpoll = 0
|
var/newpoll = 0
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
var/optiontext
|
var/optiontext
|
||||||
|
|
||||||
/mob/dead/new_player/proc/handle_player_polling()
|
/mob/dead/new_player/proc/handle_player_polling()
|
||||||
if(!GLOB.dbcon.IsConnected())
|
if(!SSdbcore.IsConnected())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
var/DBQuery/query_poll_get = GLOB.dbcon.NewQuery("SELECT id, question FROM [format_table_name("poll_question")] WHERE Now() BETWEEN starttime AND endtime [(client.holder ? "" : "AND adminonly = false")]")
|
var/datum/DBQuery/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())
|
if(!query_poll_get.warn_execute())
|
||||||
return
|
return
|
||||||
var/output = "<div align='center'><B>Player polls</B><hr><table>"
|
var/output = "<div align='center'><B>Player polls</B><hr><table>"
|
||||||
@@ -22,10 +22,10 @@
|
|||||||
/mob/dead/new_player/proc/poll_player(pollid)
|
/mob/dead/new_player/proc/poll_player(pollid)
|
||||||
if(!pollid)
|
if(!pollid)
|
||||||
return
|
return
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
var/DBQuery/query_poll_get_details = GLOB.dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid]")
|
var/datum/DBQuery/query_poll_get_details = SSdbcore.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid]")
|
||||||
if(!query_poll_get_details.warn_execute())
|
if(!query_poll_get_details.warn_execute())
|
||||||
return
|
return
|
||||||
var/pollstarttime = ""
|
var/pollstarttime = ""
|
||||||
@@ -41,14 +41,14 @@
|
|||||||
multiplechoiceoptions = text2num(query_poll_get_details.item[5])
|
multiplechoiceoptions = text2num(query_poll_get_details.item[5])
|
||||||
switch(polltype)
|
switch(polltype)
|
||||||
if(POLLTYPE_OPTION)
|
if(POLLTYPE_OPTION)
|
||||||
var/DBQuery/query_option_get_votes = GLOB.dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_option_get_votes = SSdbcore.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
||||||
if(!query_option_get_votes.warn_execute())
|
if(!query_option_get_votes.warn_execute())
|
||||||
return
|
return
|
||||||
var/votedoptionid = 0
|
var/votedoptionid = 0
|
||||||
if(query_option_get_votes.NextRow())
|
if(query_option_get_votes.NextRow())
|
||||||
votedoptionid = text2num(query_option_get_votes.item[1])
|
votedoptionid = text2num(query_option_get_votes.item[1])
|
||||||
var/list/datum/polloption/options = list()
|
var/list/datum/polloption/options = list()
|
||||||
var/DBQuery/query_option_options = GLOB.dbcon.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
var/datum/DBQuery/query_option_options = SSdbcore.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
||||||
if(!query_option_options.warn_execute())
|
if(!query_option_options.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_option_options.NextRow())
|
while(query_option_options.NextRow())
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
src << browse(null ,"window=playerpolllist")
|
src << browse(null ,"window=playerpolllist")
|
||||||
src << browse(output,"window=playerpoll;size=500x250")
|
src << browse(output,"window=playerpoll;size=500x250")
|
||||||
if(POLLTYPE_TEXT)
|
if(POLLTYPE_TEXT)
|
||||||
var/DBQuery/query_text_get_votes = GLOB.dbcon.NewQuery("SELECT replytext FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_text_get_votes = SSdbcore.NewQuery("SELECT replytext FROM [format_table_name("poll_textreply")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
||||||
if(!query_text_get_votes.warn_execute())
|
if(!query_text_get_votes.warn_execute())
|
||||||
return
|
return
|
||||||
var/vote_text = ""
|
var/vote_text = ""
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
src << browse(null ,"window=playerpolllist")
|
src << browse(null ,"window=playerpolllist")
|
||||||
src << browse(output,"window=playerpoll;size=500x500")
|
src << browse(output,"window=playerpoll;size=500x500")
|
||||||
if(POLLTYPE_RATING)
|
if(POLLTYPE_RATING)
|
||||||
var/DBQuery/query_rating_get_votes = GLOB.dbcon.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/DBQuery/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")
|
||||||
if(!query_rating_get_votes.warn_execute())
|
if(!query_rating_get_votes.warn_execute())
|
||||||
return
|
return
|
||||||
var/output = "<div align='center'><B>Player poll</B><hr>"
|
var/output = "<div align='center'><B>Player poll</B><hr>"
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
output += "<input type='hidden' name='votetype' value=[POLLTYPE_RATING]>"
|
output += "<input type='hidden' name='votetype' value=[POLLTYPE_RATING]>"
|
||||||
var/minid = 999999
|
var/minid = 999999
|
||||||
var/maxid = 0
|
var/maxid = 0
|
||||||
var/DBQuery/query_rating_options = GLOB.dbcon.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
var/datum/DBQuery/query_rating_options = SSdbcore.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
||||||
if(!query_rating_options.warn_execute())
|
if(!query_rating_options.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_rating_options.NextRow())
|
while(query_rating_options.NextRow())
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
src << browse(null ,"window=playerpolllist")
|
src << browse(null ,"window=playerpolllist")
|
||||||
src << browse(output,"window=playerpoll;size=500x500")
|
src << browse(output,"window=playerpoll;size=500x500")
|
||||||
if(POLLTYPE_MULTI)
|
if(POLLTYPE_MULTI)
|
||||||
var/DBQuery/query_multi_get_votes = GLOB.dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_multi_get_votes = SSdbcore.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
||||||
if(!query_multi_get_votes.warn_execute())
|
if(!query_multi_get_votes.warn_execute())
|
||||||
return
|
return
|
||||||
var/list/votedfor = list()
|
var/list/votedfor = list()
|
||||||
@@ -172,7 +172,7 @@
|
|||||||
var/list/datum/polloption/options = list()
|
var/list/datum/polloption/options = list()
|
||||||
var/maxoptionid = 0
|
var/maxoptionid = 0
|
||||||
var/minoptionid = 0
|
var/minoptionid = 0
|
||||||
var/DBQuery/query_multi_options = GLOB.dbcon.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
var/datum/DBQuery/query_multi_options = SSdbcore.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
||||||
if(!query_multi_options.warn_execute())
|
if(!query_multi_options.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_multi_options.NextRow())
|
while(query_multi_options.NextRow())
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
var/datum/asset/irv_assets = get_asset_datum(/datum/asset/simple/IRV)
|
var/datum/asset/irv_assets = get_asset_datum(/datum/asset/simple/IRV)
|
||||||
irv_assets.send(src)
|
irv_assets.send(src)
|
||||||
|
|
||||||
var/DBQuery/query_irv_get_votes = GLOB.dbcon.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_irv_get_votes = SSdbcore.NewQuery("SELECT optionid FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
||||||
if(!query_irv_get_votes.warn_execute())
|
if(!query_irv_get_votes.warn_execute())
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@
|
|||||||
|
|
||||||
var/list/datum/polloption/options = list()
|
var/list/datum/polloption/options = list()
|
||||||
|
|
||||||
var/DBQuery/query_irv_options = GLOB.dbcon.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
var/datum/DBQuery/query_irv_options = SSdbcore.NewQuery("SELECT id, text FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
||||||
if(!query_irv_options.warn_execute())
|
if(!query_irv_options.warn_execute())
|
||||||
return
|
return
|
||||||
while(query_irv_options.NextRow())
|
while(query_irv_options.NextRow())
|
||||||
@@ -327,10 +327,10 @@
|
|||||||
var/table = "poll_vote"
|
var/table = "poll_vote"
|
||||||
if (text)
|
if (text)
|
||||||
table = "poll_textreply"
|
table = "poll_textreply"
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(usr, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return
|
return
|
||||||
var/DBQuery/query_hasvoted = GLOB.dbcon.NewQuery("SELECT id FROM `[format_table_name(table)]` WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_hasvoted = SSdbcore.NewQuery("SELECT id FROM `[format_table_name(table)]` WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
||||||
if(!query_hasvoted.warn_execute())
|
if(!query_hasvoted.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_hasvoted.NextRow())
|
if(query_hasvoted.NextRow())
|
||||||
@@ -355,14 +355,14 @@
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
/mob/dead/new_player/proc/vote_valid_check(pollid, holder, type)
|
/mob/dead/new_player/proc/vote_valid_check(pollid, holder, type)
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return 0
|
return 0
|
||||||
pollid = text2num(pollid)
|
pollid = text2num(pollid)
|
||||||
if (!pollid || pollid < 0)
|
if (!pollid || pollid < 0)
|
||||||
return 0
|
return 0
|
||||||
//validate the poll is actually the right type of poll and its still active
|
//validate the poll is actually the right type of poll and its still active
|
||||||
var/DBQuery/query_validate_poll = GLOB.dbcon.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/DBQuery/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")]")
|
||||||
if(!query_validate_poll.warn_execute())
|
if(!query_validate_poll.warn_execute())
|
||||||
return 0
|
return 0
|
||||||
if (!query_validate_poll.NextRow())
|
if (!query_validate_poll.NextRow())
|
||||||
@@ -370,7 +370,7 @@
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
/mob/dead/new_player/proc/vote_on_irv_poll(pollid, list/votelist)
|
/mob/dead/new_player/proc/vote_on_irv_poll(pollid, list/votelist)
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return 0
|
return 0
|
||||||
if (!vote_rig_check())
|
if (!vote_rig_check())
|
||||||
@@ -395,7 +395,7 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
//lets collect the options
|
//lets collect the options
|
||||||
var/DBQuery/query_irv_id = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
var/datum/DBQuery/query_irv_id = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_option")] WHERE pollid = [pollid]")
|
||||||
if(!query_irv_id.warn_execute())
|
if(!query_irv_id.warn_execute())
|
||||||
return 0
|
return 0
|
||||||
var/list/optionlist = list()
|
var/list/optionlist = list()
|
||||||
@@ -426,12 +426,12 @@
|
|||||||
sqlrowlist += "(Now(), [pollid], [vote], '[sanitizeSQL(ckey)]', INET_ATON('[sanitizeSQL(address)]'), '[sanitizeSQL(rank)]')"
|
sqlrowlist += "(Now(), [pollid], [vote], '[sanitizeSQL(ckey)]', INET_ATON('[sanitizeSQL(address)]'), '[sanitizeSQL(rank)]')"
|
||||||
|
|
||||||
//now lets delete their old votes (if any)
|
//now lets delete their old votes (if any)
|
||||||
var/DBQuery/query_irv_del_old = GLOB.dbcon.NewQuery("DELETE FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_irv_del_old = SSdbcore.NewQuery("DELETE FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
||||||
if(!query_irv_del_old.warn_execute())
|
if(!query_irv_del_old.warn_execute())
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
//now to add the new ones.
|
//now to add the new ones.
|
||||||
var/DBQuery/query_irv_vote = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (datetime, pollid, optionid, ckey, ip, adminrank) VALUES [sqlrowlist]")
|
var/datum/DBQuery/query_irv_vote = SSdbcore.NewQuery("INSERT INTO [format_table_name("poll_vote")] (datetime, pollid, optionid, ckey, ip, adminrank) VALUES [sqlrowlist]")
|
||||||
if(!query_irv_vote.warn_execute())
|
if(!query_irv_vote.warn_execute())
|
||||||
return 0
|
return 0
|
||||||
src << browse(null,"window=playerpoll")
|
src << browse(null,"window=playerpoll")
|
||||||
@@ -439,7 +439,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/mob/dead/new_player/proc/vote_on_poll(pollid, optionid)
|
/mob/dead/new_player/proc/vote_on_poll(pollid, optionid)
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return 0
|
return 0
|
||||||
if (!vote_rig_check())
|
if (!vote_rig_check())
|
||||||
@@ -452,14 +452,14 @@
|
|||||||
var/adminrank = sanitizeSQL(poll_check_voted(pollid))
|
var/adminrank = sanitizeSQL(poll_check_voted(pollid))
|
||||||
if(!adminrank)
|
if(!adminrank)
|
||||||
return
|
return
|
||||||
var/DBQuery/query_option_vote = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (datetime, pollid, optionid, ckey, ip, adminrank) VALUES (Now(), [pollid], [optionid], '[ckey]', INET_ATON('[client.address]'), '[adminrank]')")
|
var/datum/DBQuery/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('[client.address]'), '[adminrank]')")
|
||||||
if(!query_option_vote.warn_execute())
|
if(!query_option_vote.warn_execute())
|
||||||
return
|
return
|
||||||
usr << browse(null,"window=playerpoll")
|
usr << browse(null,"window=playerpoll")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/mob/dead/new_player/proc/log_text_poll_reply(pollid, replytext)
|
/mob/dead/new_player/proc/log_text_poll_reply(pollid, replytext)
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return 0
|
return 0
|
||||||
if (!vote_rig_check())
|
if (!vote_rig_check())
|
||||||
@@ -479,14 +479,14 @@
|
|||||||
if(!(length(replytext) > 0) || !(length(replytext) <= 8000))
|
if(!(length(replytext) > 0) || !(length(replytext) <= 8000))
|
||||||
to_chat(usr, "The text you entered was invalid or too long. Please correct the text and submit again.")
|
to_chat(usr, "The text you entered was invalid or too long. Please correct the text and submit again.")
|
||||||
return
|
return
|
||||||
var/DBQuery/query_text_vote = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_textreply")] (datetime ,pollid ,ckey ,ip ,replytext ,adminrank) VALUES (Now(), [pollid], '[ckey]', INET_ATON('[client.address]'), '[replytext]', '[adminrank]')")
|
var/datum/DBQuery/query_text_vote = SSdbcore.NewQuery("INSERT INTO [format_table_name("poll_textreply")] (datetime ,pollid ,ckey ,ip ,replytext ,adminrank) VALUES (Now(), [pollid], '[ckey]', INET_ATON('[client.address]'), '[replytext]', '[adminrank]')")
|
||||||
if(!query_text_vote.warn_execute())
|
if(!query_text_vote.warn_execute())
|
||||||
return
|
return
|
||||||
usr << browse(null,"window=playerpoll")
|
usr << browse(null,"window=playerpoll")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/mob/dead/new_player/proc/vote_on_numval_poll(pollid, optionid, rating)
|
/mob/dead/new_player/proc/vote_on_numval_poll(pollid, optionid, rating)
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return 0
|
return 0
|
||||||
if (!vote_rig_check())
|
if (!vote_rig_check())
|
||||||
@@ -496,7 +496,7 @@
|
|||||||
//validate the poll
|
//validate the poll
|
||||||
if (!vote_valid_check(pollid, client.holder, POLLTYPE_RATING))
|
if (!vote_valid_check(pollid, client.holder, POLLTYPE_RATING))
|
||||||
return 0
|
return 0
|
||||||
var/DBQuery/query_numval_hasvoted = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE optionid = [optionid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_numval_hasvoted = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE optionid = [optionid] AND ckey = '[ckey]'")
|
||||||
if(!query_numval_hasvoted.warn_execute())
|
if(!query_numval_hasvoted.warn_execute())
|
||||||
return
|
return
|
||||||
if(query_numval_hasvoted.NextRow())
|
if(query_numval_hasvoted.NextRow())
|
||||||
@@ -506,14 +506,14 @@
|
|||||||
if(client.holder)
|
if(client.holder)
|
||||||
adminrank = client.holder.rank.name
|
adminrank = client.holder.rank.name
|
||||||
adminrank = sanitizeSQL(adminrank)
|
adminrank = sanitizeSQL(adminrank)
|
||||||
var/DBQuery/query_numval_vote = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (Now(), [pollid], [optionid], '[ckey]', INET_ATON('[client.address]'), '[adminrank]', [(isnull(rating)) ? "null" : rating])")
|
var/datum/DBQuery/query_numval_vote = SSdbcore.NewQuery("INSERT INTO [format_table_name("poll_vote")] (datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (Now(), [pollid], [optionid], '[ckey]', INET_ATON('[client.address]'), '[adminrank]', [(isnull(rating)) ? "null" : rating])")
|
||||||
if(!query_numval_vote.warn_execute())
|
if(!query_numval_vote.warn_execute())
|
||||||
return
|
return
|
||||||
usr << browse(null,"window=playerpoll")
|
usr << browse(null,"window=playerpoll")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
/mob/dead/new_player/proc/vote_on_multi_poll(pollid, optionid)
|
/mob/dead/new_player/proc/vote_on_multi_poll(pollid, optionid)
|
||||||
if (!GLOB.dbcon.Connect())
|
if (!SSdbcore.Connect())
|
||||||
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
to_chat(src, "<span class='danger'>Failed to establish database connection.</span>")
|
||||||
return 0
|
return 0
|
||||||
if (!vote_rig_check())
|
if (!vote_rig_check())
|
||||||
@@ -523,13 +523,13 @@
|
|||||||
//validate the poll
|
//validate the poll
|
||||||
if (!vote_valid_check(pollid, client.holder, POLLTYPE_MULTI))
|
if (!vote_valid_check(pollid, client.holder, POLLTYPE_MULTI))
|
||||||
return 0
|
return 0
|
||||||
var/DBQuery/query_multi_choicelen = GLOB.dbcon.NewQuery("SELECT multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid]")
|
var/datum/DBQuery/query_multi_choicelen = SSdbcore.NewQuery("SELECT multiplechoiceoptions FROM [format_table_name("poll_question")] WHERE id = [pollid]")
|
||||||
if(!query_multi_choicelen.warn_execute())
|
if(!query_multi_choicelen.warn_execute())
|
||||||
return 1
|
return 1
|
||||||
var/i
|
var/i
|
||||||
if(query_multi_choicelen.NextRow())
|
if(query_multi_choicelen.NextRow())
|
||||||
i = text2num(query_multi_choicelen.item[1])
|
i = text2num(query_multi_choicelen.item[1])
|
||||||
var/DBQuery/query_multi_hasvoted = GLOB.dbcon.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
var/datum/DBQuery/query_multi_hasvoted = SSdbcore.NewQuery("SELECT id FROM [format_table_name("poll_vote")] WHERE pollid = [pollid] AND ckey = '[ckey]'")
|
||||||
if(!query_multi_hasvoted.warn_execute())
|
if(!query_multi_hasvoted.warn_execute())
|
||||||
return 1
|
return 1
|
||||||
while(i)
|
while(i)
|
||||||
@@ -543,7 +543,7 @@
|
|||||||
if(client.holder)
|
if(client.holder)
|
||||||
adminrank = client.holder.rank.name
|
adminrank = client.holder.rank.name
|
||||||
adminrank = sanitizeSQL(adminrank)
|
adminrank = sanitizeSQL(adminrank)
|
||||||
var/DBQuery/query_multi_vote = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("poll_vote")] (datetime, pollid, optionid, ckey, ip, adminrank) VALUES (Now(), [pollid], [optionid], '[ckey]', INET_ATON('[client.address]'), '[adminrank]')")
|
var/datum/DBQuery/query_multi_vote = SSdbcore.NewQuery("INSERT INTO [format_table_name("poll_vote")] (datetime, pollid, optionid, ckey, ip, adminrank) VALUES (Now(), [pollid], [optionid], '[ckey]', INET_ATON('[client.address]'), '[adminrank]')")
|
||||||
if(!query_multi_vote.warn_execute())
|
if(!query_multi_vote.warn_execute())
|
||||||
return 1
|
return 1
|
||||||
usr << browse(null,"window=playerpoll")
|
usr << browse(null,"window=playerpoll")
|
||||||
|
|||||||
@@ -1,243 +0,0 @@
|
|||||||
#define FAILED_DB_CONNECTION_CUTOFF 5
|
|
||||||
|
|
||||||
//cursors
|
|
||||||
#define Default_Cursor 0
|
|
||||||
#define Client_Cursor 1
|
|
||||||
#define Server_Cursor 2
|
|
||||||
//conversions
|
|
||||||
#define TEXT_CONV 1
|
|
||||||
#define RSC_FILE_CONV 2
|
|
||||||
#define NUMBER_CONV 3
|
|
||||||
//column flag values:
|
|
||||||
#define IS_NUMERIC 1
|
|
||||||
#define IS_BINARY 2
|
|
||||||
#define IS_NOT_NULL 4
|
|
||||||
#define IS_PRIMARY_KEY 8
|
|
||||||
#define IS_UNSIGNED 16
|
|
||||||
//types
|
|
||||||
#define TINYINT 1
|
|
||||||
#define SMALLINT 2
|
|
||||||
#define MEDIUMINT 3
|
|
||||||
#define INTEGER 4
|
|
||||||
#define BIGINT 5
|
|
||||||
#define DECIMAL 6
|
|
||||||
#define FLOAT 7
|
|
||||||
#define DOUBLE 8
|
|
||||||
#define DATE 9
|
|
||||||
#define DATETIME 10
|
|
||||||
#define TIMESTAMP 11
|
|
||||||
#define TIME 12
|
|
||||||
#define STRING 13
|
|
||||||
#define BLOB 14
|
|
||||||
// TODO: Investigate more recent type additions and see if I can handle them. - Nadrew
|
|
||||||
|
|
||||||
|
|
||||||
// Deprecated! See global.dm for new configuration vars
|
|
||||||
/*
|
|
||||||
var/DB_SERVER = "" // This is the location of your MySQL server (localhost is USUALLY fine)
|
|
||||||
var/DB_PORT = 3306 // This is the port your MySQL server is running on (3306 is the default)
|
|
||||||
*/
|
|
||||||
|
|
||||||
DBConnection
|
|
||||||
var/_db_con // This variable contains a reference to the actual database connection.
|
|
||||||
var/dbi // This variable is a string containing the DBI MySQL requires.
|
|
||||||
var/user // This variable contains the username data.
|
|
||||||
var/password // This variable contains the password data.
|
|
||||||
var/default_cursor // This contains the default database cursor data.
|
|
||||||
//
|
|
||||||
var/server = ""
|
|
||||||
var/port = 3306
|
|
||||||
var/failed_connections = 0
|
|
||||||
|
|
||||||
DBConnection/New(dbi_handler,username,password_handler,cursor_handler)
|
|
||||||
src.dbi = dbi_handler
|
|
||||||
src.user = username
|
|
||||||
src.password = password_handler
|
|
||||||
src.default_cursor = cursor_handler
|
|
||||||
_db_con = _dm_db_new_con()
|
|
||||||
|
|
||||||
DBConnection/proc/Connect()
|
|
||||||
if(IsConnected())
|
|
||||||
return TRUE
|
|
||||||
|
|
||||||
if(failed_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to connect anymore.
|
|
||||||
return FALSE
|
|
||||||
|
|
||||||
var/user = global.sqlfdbklogin
|
|
||||||
var/pass = global.sqlfdbkpass
|
|
||||||
var/db = global.sqlfdbkdb
|
|
||||||
var/address = global.sqladdress
|
|
||||||
var/port = global.sqlport
|
|
||||||
|
|
||||||
doConnect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
|
||||||
. = IsConnected()
|
|
||||||
if (!. && config.sql_enabled)
|
|
||||||
log_sql("Connect() failed | [ErrorMsg()]")
|
|
||||||
++failed_connections
|
|
||||||
|
|
||||||
DBConnection/proc/doConnect(dbi_handler=src.dbi,user_handler=src.user,password_handler=src.password,cursor_handler)
|
|
||||||
if(!config.sql_enabled)
|
|
||||||
return 0
|
|
||||||
if(!src) return 0
|
|
||||||
cursor_handler = src.default_cursor
|
|
||||||
if(!cursor_handler) cursor_handler = Default_Cursor
|
|
||||||
return _dm_db_connect(_db_con,dbi_handler,user_handler,password_handler,cursor_handler,null)
|
|
||||||
|
|
||||||
DBConnection/proc/Disconnect()
|
|
||||||
failed_connections = 0
|
|
||||||
return _dm_db_close(_db_con)
|
|
||||||
|
|
||||||
DBConnection/proc/IsConnected()
|
|
||||||
if(!config.sql_enabled) return 0
|
|
||||||
var/success = _dm_db_is_connected(_db_con)
|
|
||||||
return success
|
|
||||||
|
|
||||||
DBConnection/proc/Quote(str) return _dm_db_quote(_db_con,str)
|
|
||||||
|
|
||||||
DBConnection/proc/ErrorMsg() return _dm_db_error_msg(_db_con)
|
|
||||||
DBConnection/proc/SelectDB(database_name,dbi)
|
|
||||||
if(IsConnected()) Disconnect()
|
|
||||||
//return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[DB_SERVER]:[DB_PORT]"]",user,password)
|
|
||||||
return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[global.sqladdress]:[global.sqlport]"]",user,password)
|
|
||||||
DBConnection/proc/NewQuery(sql_query,cursor_handler=src.default_cursor)
|
|
||||||
if(IsAdminAdvancedProcCall())
|
|
||||||
log_admin_private("WARNING: Advanced admin proc call DB query created!: [sql_query]")
|
|
||||||
return new/DBQuery(sql_query,src,cursor_handler)
|
|
||||||
|
|
||||||
|
|
||||||
DBQuery/New(sql_query,DBConnection/connection_handler,cursor_handler)
|
|
||||||
if(sql_query) src.sql = sql_query
|
|
||||||
if(connection_handler) src.db_connection = connection_handler
|
|
||||||
if(cursor_handler) src.default_cursor = cursor_handler
|
|
||||||
_db_query = _dm_db_new_query()
|
|
||||||
return ..()
|
|
||||||
|
|
||||||
|
|
||||||
DBQuery
|
|
||||||
var/sql // The sql query being executed.
|
|
||||||
var/default_cursor
|
|
||||||
var/list/columns //list of DB Columns populated by Columns()
|
|
||||||
var/list/conversions
|
|
||||||
var/list/item[0] //list of data values populated by NextRow()
|
|
||||||
|
|
||||||
var/DBConnection/db_connection
|
|
||||||
var/_db_query
|
|
||||||
|
|
||||||
DBQuery/proc/Connect(DBConnection/connection_handler) src.db_connection = connection_handler
|
|
||||||
|
|
||||||
DBQuery/proc/warn_execute()
|
|
||||||
. = Execute()
|
|
||||||
if(!.)
|
|
||||||
to_chat(usr, "<span class='danger'>A SQL error occured during this operation, check the server logs.</span>")
|
|
||||||
|
|
||||||
DBQuery/proc/Execute(sql_query=src.sql,cursor_handler=default_cursor, log_error = 1)
|
|
||||||
Close()
|
|
||||||
. = _dm_db_execute(_db_query,sql_query,db_connection._db_con,cursor_handler,null)
|
|
||||||
if(!. && log_error)
|
|
||||||
log_sql("[ErrorMsg()] | Query used: [sql]")
|
|
||||||
|
|
||||||
DBQuery/proc/NextRow() return _dm_db_next_row(_db_query,item,conversions)
|
|
||||||
|
|
||||||
DBQuery/proc/RowsAffected() return _dm_db_rows_affected(_db_query)
|
|
||||||
|
|
||||||
DBQuery/proc/RowCount() return _dm_db_row_count(_db_query)
|
|
||||||
|
|
||||||
DBQuery/proc/ErrorMsg() return _dm_db_error_msg(_db_query)
|
|
||||||
|
|
||||||
DBQuery/proc/Columns()
|
|
||||||
if(!columns)
|
|
||||||
columns = _dm_db_columns(_db_query,/DBColumn)
|
|
||||||
return columns
|
|
||||||
|
|
||||||
DBQuery/proc/GetRowData()
|
|
||||||
var/list/columns = Columns()
|
|
||||||
var/list/results
|
|
||||||
if(columns.len)
|
|
||||||
results = list()
|
|
||||||
for(var/C in columns)
|
|
||||||
results+=C
|
|
||||||
var/DBColumn/cur_col = columns[C]
|
|
||||||
results[C] = src.item[(cur_col.position+1)]
|
|
||||||
return results
|
|
||||||
|
|
||||||
DBQuery/proc/Close()
|
|
||||||
item.len = 0
|
|
||||||
columns = null
|
|
||||||
conversions = null
|
|
||||||
return _dm_db_close(_db_query)
|
|
||||||
|
|
||||||
DBQuery/proc/Quote(str)
|
|
||||||
return db_connection.Quote(str)
|
|
||||||
|
|
||||||
DBQuery/proc/SetConversion(column,conversion)
|
|
||||||
if(istext(column)) column = columns.Find(column)
|
|
||||||
if(!conversions) conversions = new/list(column)
|
|
||||||
else if(conversions.len < column) conversions.len = column
|
|
||||||
conversions[column] = conversion
|
|
||||||
|
|
||||||
|
|
||||||
DBColumn
|
|
||||||
var/name
|
|
||||||
var/table
|
|
||||||
var/position //1-based index into item data
|
|
||||||
var/sql_type
|
|
||||||
var/flags
|
|
||||||
var/length
|
|
||||||
var/max_length
|
|
||||||
|
|
||||||
DBColumn/New(name_handler,table_handler,position_handler,type_handler,flag_handler,length_handler,max_length_handler)
|
|
||||||
src.name = name_handler
|
|
||||||
src.table = table_handler
|
|
||||||
src.position = position_handler
|
|
||||||
src.sql_type = type_handler
|
|
||||||
src.flags = flag_handler
|
|
||||||
src.length = length_handler
|
|
||||||
src.max_length = max_length_handler
|
|
||||||
return ..()
|
|
||||||
|
|
||||||
|
|
||||||
DBColumn/proc/SqlTypeName(type_handler=src.sql_type)
|
|
||||||
switch(type_handler)
|
|
||||||
if(TINYINT) return "TINYINT"
|
|
||||||
if(SMALLINT) return "SMALLINT"
|
|
||||||
if(MEDIUMINT) return "MEDIUMINT"
|
|
||||||
if(INTEGER) return "INTEGER"
|
|
||||||
if(BIGINT) return "BIGINT"
|
|
||||||
if(FLOAT) return "FLOAT"
|
|
||||||
if(DOUBLE) return "DOUBLE"
|
|
||||||
if(DATE) return "DATE"
|
|
||||||
if(DATETIME) return "DATETIME"
|
|
||||||
if(TIMESTAMP) return "TIMESTAMP"
|
|
||||||
if(TIME) return "TIME"
|
|
||||||
if(STRING) return "STRING"
|
|
||||||
if(BLOB) return "BLOB"
|
|
||||||
|
|
||||||
|
|
||||||
#undef Default_Cursor
|
|
||||||
#undef Client_Cursor
|
|
||||||
#undef Server_Cursor
|
|
||||||
#undef TEXT_CONV
|
|
||||||
#undef RSC_FILE_CONV
|
|
||||||
#undef NUMBER_CONV
|
|
||||||
#undef IS_NUMERIC
|
|
||||||
#undef IS_BINARY
|
|
||||||
#undef IS_NOT_NULL
|
|
||||||
#undef IS_PRIMARY_KEY
|
|
||||||
#undef IS_UNSIGNED
|
|
||||||
#undef TINYINT
|
|
||||||
#undef SMALLINT
|
|
||||||
#undef MEDIUMINT
|
|
||||||
#undef INTEGER
|
|
||||||
#undef BIGINT
|
|
||||||
#undef DECIMAL
|
|
||||||
#undef FLOAT
|
|
||||||
#undef DOUBLE
|
|
||||||
#undef DATE
|
|
||||||
#undef DATETIME
|
|
||||||
#undef TIMESTAMP
|
|
||||||
#undef TIME
|
|
||||||
#undef STRING
|
|
||||||
#undef BLOB
|
|
||||||
|
|
||||||
|
|
||||||
#undef FAILED_DB_CONNECTION_CUTOFF
|
|
||||||
@@ -62,10 +62,10 @@ GLOBAL_DATUM_INIT(blackbox, /datum/feedback, new)
|
|||||||
if (!feedback) return
|
if (!feedback) return
|
||||||
|
|
||||||
round_end_data_gathering() //round_end time logging and some other data processing
|
round_end_data_gathering() //round_end time logging and some other data processing
|
||||||
if (!GLOB.dbcon.Connect()) return
|
if (!SSdbcore.Connect()) return
|
||||||
var/round_id
|
var/round_id
|
||||||
|
|
||||||
var/DBQuery/query_feedback_max_id = GLOB.dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
|
var/datum/DBQuery/query_feedback_max_id = SSdbcore.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
|
||||||
if(!query_feedback_max_id.Execute())
|
if(!query_feedback_max_id.Execute())
|
||||||
return
|
return
|
||||||
while (query_feedback_max_id.NextRow())
|
while (query_feedback_max_id.NextRow())
|
||||||
@@ -86,7 +86,7 @@ GLOBAL_DATUM_INIT(blackbox, /datum/feedback, new)
|
|||||||
if (sqlrowlist == "")
|
if (sqlrowlist == "")
|
||||||
return
|
return
|
||||||
|
|
||||||
var/DBQuery/query_feedback_save = GLOB.dbcon.NewQuery("INSERT DELAYED IGNORE INTO [format_table_name("feedback")] VALUES " + sqlrowlist)
|
var/datum/DBQuery/query_feedback_save = SSdbcore.NewQuery("INSERT DELAYED IGNORE INTO [format_table_name("feedback")] VALUES " + sqlrowlist)
|
||||||
query_feedback_save.Execute()
|
query_feedback_save.Execute()
|
||||||
|
|
||||||
|
|
||||||
@@ -209,20 +209,20 @@ GLOBAL_DATUM_INIT(blackbox, /datum/feedback, new)
|
|||||||
/proc/sql_poll_population()
|
/proc/sql_poll_population()
|
||||||
if(!config.sql_enabled)
|
if(!config.sql_enabled)
|
||||||
return
|
return
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
var/playercount = 0
|
var/playercount = 0
|
||||||
for(var/mob/M in GLOB.player_list)
|
for(var/mob/M in GLOB.player_list)
|
||||||
if(M.client)
|
if(M.client)
|
||||||
playercount += 1
|
playercount += 1
|
||||||
var/admincount = GLOB.admins.len
|
var/admincount = GLOB.admins.len
|
||||||
var/DBQuery/query_record_playercount = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
var/datum/DBQuery/query_record_playercount = SSdbcore.NewQuery("INSERT INTO [format_table_name("legacy_population")] (playercount, admincount, time, server_ip, server_port) VALUES ([playercount], [admincount], '[SQLtime()]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||||
query_record_playercount.Execute()
|
query_record_playercount.Execute()
|
||||||
|
|
||||||
/proc/sql_report_death(mob/living/L)
|
/proc/sql_report_death(mob/living/L)
|
||||||
if(!config.sql_enabled)
|
if(!config.sql_enabled)
|
||||||
return
|
return
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
return
|
return
|
||||||
if(!L || !L.key || !L.mind)
|
if(!L || !L.key || !L.mind)
|
||||||
return
|
return
|
||||||
@@ -249,5 +249,5 @@ GLOBAL_DATUM_INIT(blackbox, /datum/feedback, new)
|
|||||||
var/sqlstamina = sanitizeSQL(L.getStaminaLoss())
|
var/sqlstamina = sanitizeSQL(L.getStaminaLoss())
|
||||||
var/coord = sanitizeSQL("[L.x], [L.y], [L.z]")
|
var/coord = sanitizeSQL("[L.x], [L.y], [L.z]")
|
||||||
var/map = sanitizeSQL(SSmapping.config.map_name)
|
var/map = sanitizeSQL(SSmapping.config.map_name)
|
||||||
var/DBQuery/query_report_death = GLOB.dbcon.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, coord, mapname, server_ip, server_port) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[SQLtime()]', '[laname]', '[lakey]', '[sqlgender]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[coord]', '[map]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
var/datum/DBQuery/query_report_death = SSdbcore.NewQuery("INSERT INTO [format_table_name("death")] (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, coord, mapname, server_ip, server_port) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[SQLtime()]', '[laname]', '[lakey]', '[sqlgender]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[coord]', '[map]', INET_ATON('[world.internet_address]'), '[world.port]')")
|
||||||
query_report_death.Execute()
|
query_report_death.Execute()
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
GLOB.timezoneOffset = text2num(time2text(0,"hh")) * 36000
|
GLOB.timezoneOffset = text2num(time2text(0,"hh")) * 36000
|
||||||
|
|
||||||
if(config.sql_enabled)
|
if(config.sql_enabled)
|
||||||
if(!GLOB.dbcon.Connect())
|
if(!SSdbcore.Connect())
|
||||||
log_world("Your server failed to establish a connection with the database.")
|
log_world("Your server failed to establish a connection with the database.")
|
||||||
else
|
else
|
||||||
log_world("Database connection established.")
|
log_world("Database connection established.")
|
||||||
|
|||||||
@@ -160,6 +160,7 @@
|
|||||||
#include "code\controllers\subsystem\atoms.dm"
|
#include "code\controllers\subsystem\atoms.dm"
|
||||||
#include "code\controllers\subsystem\augury.dm"
|
#include "code\controllers\subsystem\augury.dm"
|
||||||
#include "code\controllers\subsystem\communications.dm"
|
#include "code\controllers\subsystem\communications.dm"
|
||||||
|
#include "code\controllers\subsystem\dbcore.dm"
|
||||||
#include "code\controllers\subsystem\disease.dm"
|
#include "code\controllers\subsystem\disease.dm"
|
||||||
#include "code\controllers\subsystem\events.dm"
|
#include "code\controllers\subsystem\events.dm"
|
||||||
#include "code\controllers\subsystem\fire_burning.dm"
|
#include "code\controllers\subsystem\fire_burning.dm"
|
||||||
@@ -2077,7 +2078,6 @@
|
|||||||
#include "code\modules\VR\vr_sleeper.dm"
|
#include "code\modules\VR\vr_sleeper.dm"
|
||||||
#include "code\modules\zombie\items.dm"
|
#include "code\modules\zombie\items.dm"
|
||||||
#include "code\modules\zombie\organs.dm"
|
#include "code\modules\zombie\organs.dm"
|
||||||
#include "code\orphaned_procs\dbcore.dm"
|
|
||||||
#include "code\orphaned_procs\statistics.dm"
|
#include "code\orphaned_procs\statistics.dm"
|
||||||
#include "interface\interface.dm"
|
#include "interface\interface.dm"
|
||||||
#include "interface\stylesheet.dm"
|
#include "interface\stylesheet.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user