mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-25 05:51:56 +01:00
Merge pull request #33 from skull132/SQL-backend-import
Sql backend import
This commit is contained in:
+10
-10
@@ -1,4 +1,4 @@
|
||||
CREATE TABLE `erro_admin` (
|
||||
CREATE TABLE `ss13_admin` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
`rank` varchar(32) NOT NULL DEFAULT 'Administrator',
|
||||
@@ -7,7 +7,7 @@ CREATE TABLE `erro_admin` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_admin_log` (
|
||||
CREATE TABLE `ss13_admin_log` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`datetime` datetime NOT NULL,
|
||||
`adminckey` varchar(32) NOT NULL,
|
||||
@@ -16,7 +16,7 @@ CREATE TABLE `erro_admin_log` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_ban` (
|
||||
CREATE TABLE `ss13_ban` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`bantime` datetime NOT NULL,
|
||||
`serverip` varchar(32) NOT NULL,
|
||||
@@ -43,7 +43,7 @@ CREATE TABLE `erro_ban` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_feedback` (
|
||||
CREATE TABLE `ss13_feedback` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`time` datetime NOT NULL,
|
||||
`round_id` int(8) NOT NULL,
|
||||
@@ -53,7 +53,7 @@ CREATE TABLE `erro_feedback` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_player` (
|
||||
CREATE TABLE `ss13_player` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
`firstseen` datetime NOT NULL,
|
||||
@@ -65,7 +65,7 @@ CREATE TABLE `erro_player` (
|
||||
UNIQUE KEY `ckey` (`ckey`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_poll_option` (
|
||||
CREATE TABLE `ss13_poll_option` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`pollid` int(11) NOT NULL,
|
||||
`text` varchar(255) NOT NULL,
|
||||
@@ -78,7 +78,7 @@ CREATE TABLE `erro_poll_option` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_poll_question` (
|
||||
CREATE TABLE `ss13_poll_question` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`polltype` varchar(16) NOT NULL DEFAULT 'OPTION',
|
||||
`starttime` datetime NOT NULL,
|
||||
@@ -88,7 +88,7 @@ CREATE TABLE `erro_poll_question` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_poll_textreply` (
|
||||
CREATE TABLE `ss13_poll_textreply` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`datetime` datetime NOT NULL,
|
||||
`pollid` int(11) NOT NULL,
|
||||
@@ -99,7 +99,7 @@ CREATE TABLE `erro_poll_textreply` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_poll_vote` (
|
||||
CREATE TABLE `ss13_poll_vote` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`datetime` datetime NOT NULL,
|
||||
`pollid` int(11) NOT NULL,
|
||||
@@ -111,7 +111,7 @@ CREATE TABLE `erro_poll_vote` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
|
||||
|
||||
CREATE TABLE `erro_privacy` (
|
||||
CREATE TABLE `ss13_privacy` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`datetime` datetime NOT NULL,
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
|
||||
@@ -10,7 +10,7 @@ USE `tgstation` ;
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgstation`.`death`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgstation`.`death` (
|
||||
CREATE TABLE IF NOT EXISTS `ss13_death` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT ,
|
||||
`pod` TEXT NOT NULL COMMENT 'Place of death' ,
|
||||
`coord` TEXT NOT NULL COMMENT 'X, Y, Z POD' ,
|
||||
@@ -35,7 +35,7 @@ DEFAULT CHARACTER SET = latin1;
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgstation`.`karma`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgstation`.`karma` (
|
||||
CREATE TABLE IF NOT EXISTS `ss13_karma` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT ,
|
||||
`spendername` TEXT NOT NULL ,
|
||||
`spenderkey` TEXT NOT NULL ,
|
||||
@@ -55,7 +55,7 @@ DEFAULT CHARACTER SET = latin1;
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgstation`.`karmatotals`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgstation`.`karmatotals` (
|
||||
CREATE TABLE IF NOT EXISTS `ss13_karmatotals` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT ,
|
||||
`byondkey` TEXT NOT NULL ,
|
||||
`karma` INT(11) NOT NULL ,
|
||||
@@ -68,7 +68,7 @@ DEFAULT CHARACTER SET = latin1;
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgstation`.`library`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgstation`.`library` (
|
||||
CREATE TABLE IF NOT EXISTS `ss13_library` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT ,
|
||||
`author` TEXT NOT NULL ,
|
||||
`title` TEXT NOT NULL ,
|
||||
@@ -83,7 +83,7 @@ DEFAULT CHARACTER SET = latin1;
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tgstation`.`population`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tgstation`.`population` (
|
||||
CREATE TABLE IF NOT EXISTS `ss13_population` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT ,
|
||||
`playercount` INT(11) NULL DEFAULT NULL ,
|
||||
`admincount` INT(11) NULL DEFAULT NULL ,
|
||||
|
||||
@@ -819,6 +819,7 @@
|
||||
#include "code\modules\admin\IsBanned.dm"
|
||||
#include "code\modules\admin\NewBan.dm"
|
||||
#include "code\modules\admin\player_notes.dm"
|
||||
#include "code\modules\admin\player_notes_sql.dm"
|
||||
#include "code\modules\admin\player_panel.dm"
|
||||
#include "code\modules\admin\topic.dm"
|
||||
#include "code\modules\admin\ToRban.dm"
|
||||
@@ -853,6 +854,7 @@
|
||||
#include "code\modules\admin\verbs\striketeam.dm"
|
||||
#include "code\modules\admin\verbs\ticklag.dm"
|
||||
#include "code\modules\admin\verbs\tripAI.dm"
|
||||
#include "code\modules\admin\verbs\warning.dm"
|
||||
#include "code\modules\alarm\alarm.dm"
|
||||
#include "code\modules\alarm\alarm_handler.dm"
|
||||
#include "code\modules\alarm\atmosphere_alarm.dm"
|
||||
|
||||
@@ -153,6 +153,7 @@ var/list/gamemode_cache = list()
|
||||
var/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt
|
||||
var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt
|
||||
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
|
||||
var/sql_whitelists = 0 //Defined whether the server uses an SQL based whitelist system, or the legacy one with two .txts. Config option in config.txt
|
||||
|
||||
var/simultaneous_pm_warning_timeout = 100
|
||||
|
||||
@@ -674,6 +675,9 @@ var/list/gamemode_cache = list()
|
||||
if("aggressive_changelog")
|
||||
config.aggressive_changelog = 1
|
||||
|
||||
if("sql_whitelists")
|
||||
config.sql_whitelists = 1
|
||||
|
||||
else
|
||||
log_misc("Unknown setting in configuration: '[name]'")
|
||||
|
||||
@@ -772,12 +776,6 @@ var/list/gamemode_cache = list()
|
||||
sqllogin = value
|
||||
if ("password")
|
||||
sqlpass = value
|
||||
if ("feedback_database")
|
||||
sqlfdbkdb = value
|
||||
if ("feedback_login")
|
||||
sqlfdbklogin = value
|
||||
if ("feedback_password")
|
||||
sqlfdbkpass = value
|
||||
if ("enable_stat_tracking")
|
||||
sqllogging = 1
|
||||
else
|
||||
|
||||
@@ -33,11 +33,10 @@ var/global/datum/news_controller/news_controller
|
||||
fails++
|
||||
return
|
||||
|
||||
var/DBQuery/update_query = dbcon.NewQuery("SELECT id, publishtime FROM ss13_news WHERE status = 2 ORDER BY publishtime ASC LIMIT [count],1")
|
||||
update_query.Execute()
|
||||
var/DBQuery/update_query = dbcon.NewQuery("SELECT id, publishtime FROM ss13_news WHERE status = 2 ORDER BY publishtime ASC LIMIT :count, 1")
|
||||
update_query.Execute(list(":count" = count))
|
||||
|
||||
if(update_query.ErrorMsg())
|
||||
error("SQL database query encountered an error: [update_query.ErrorMsg()].")
|
||||
fails++
|
||||
return
|
||||
|
||||
@@ -59,11 +58,10 @@ var/global/datum/news_controller/news_controller
|
||||
fails++
|
||||
return
|
||||
|
||||
var/DBQuery/publish_query = dbcon.NewQuery("SELECT channel, author, body FROM ss13_news WHERE id=[article_id]")
|
||||
publish_query.Execute()
|
||||
var/DBQuery/publish_query = dbcon.NewQuery("SELECT channel, author, body FROM ss13_news WHERE id = :article_id")
|
||||
publish_query.Execute(list(":article_id" = article_id))
|
||||
|
||||
if(publish_query.ErrorMsg())
|
||||
error("SQL database query encountered an error: [publish_query.ErrorMsg()].")
|
||||
fails++
|
||||
return
|
||||
|
||||
|
||||
+133
-63
@@ -48,45 +48,45 @@ DBConnection
|
||||
var/server = ""
|
||||
var/port = 3306
|
||||
|
||||
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
|
||||
DBConnection/New(dbi_handler, username, password_handler, cursor_handler)
|
||||
dbi = dbi_handler
|
||||
user = username
|
||||
password = password_handler
|
||||
default_cursor = cursor_handler
|
||||
_db_con = _dm_db_new_con()
|
||||
|
||||
DBConnection/proc/Connect(dbi_handler=src.dbi,user_handler=src.user,password_handler=src.password,cursor_handler)
|
||||
if(!sqllogging)
|
||||
DBConnection/proc/Connect(dbi_handler = dbi, user_handler = user, password_handler = password, cursor_handler)
|
||||
if (!sqllogging)
|
||||
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)
|
||||
if (!src)
|
||||
return 0
|
||||
cursor_handler = 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() return _dm_db_close(_db_con)
|
||||
DBConnection/proc/Disconnect()
|
||||
return _dm_db_close(_db_con)
|
||||
|
||||
DBConnection/proc/IsConnected()
|
||||
if(!sqllogging) return 0
|
||||
if(!sqllogging)
|
||||
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/Quote(str)
|
||||
return _dm_db_quote(_db_con,str)
|
||||
|
||||
DBConnection/proc/ErrorMsg()
|
||||
return _dm_db_error_msg(_db_con)
|
||||
|
||||
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]:[sqladdress]:[sqlport]"]",user,password)
|
||||
DBConnection/proc/NewQuery(sql_query,cursor_handler=src.default_cursor) 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 ..()
|
||||
return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[sqladdress]:[sqlport]"]", user, password)
|
||||
|
||||
DBConnection/proc/NewQuery(sql_query, cursor_handler = default_cursor)
|
||||
return new/DBQuery(sql_query, src, cursor_handler)
|
||||
|
||||
DBQuery
|
||||
var/sql // The sql query being executed.
|
||||
@@ -98,34 +98,53 @@ DBQuery
|
||||
var/DBConnection/db_connection
|
||||
var/_db_query
|
||||
|
||||
DBQuery/proc/Connect(DBConnection/connection_handler) src.db_connection = connection_handler
|
||||
DBQuery/New(var/sql_query, var/DBConnection/connection_handler, var/cursor_handler)
|
||||
if (sql_query)
|
||||
sql = sql_query
|
||||
if (connection_handler)
|
||||
db_connection = connection_handler
|
||||
if (cursor_handler)
|
||||
default_cursor = cursor_handler
|
||||
_db_query = _dm_db_new_query()
|
||||
return ..()
|
||||
|
||||
DBQuery/proc/Execute(sql_query=src.sql,cursor_handler=default_cursor)
|
||||
DBQuery/proc/Connect(DBConnection/connection_handler)
|
||||
db_connection = connection_handler
|
||||
|
||||
DBQuery/proc/Execute(var/list/argument_list = null, var/pass_not_found = 0, sql_query = sql, cursor_handler = default_cursor)
|
||||
Close()
|
||||
return _dm_db_execute(_db_query,sql_query,db_connection._db_con,cursor_handler,null)
|
||||
|
||||
DBQuery/proc/NextRow() return _dm_db_next_row(_db_query,item,conversions)
|
||||
if (argument_list)
|
||||
sql_query = parseArguments(sql_query, argument_list, pass_not_found)
|
||||
|
||||
DBQuery/proc/RowsAffected() return _dm_db_rows_affected(_db_query)
|
||||
return _dm_db_execute(_db_query, sql_query, db_connection._db_con, cursor_handler, null)
|
||||
|
||||
DBQuery/proc/RowCount() return _dm_db_row_count(_db_query)
|
||||
DBQuery/proc/NextRow()
|
||||
return _dm_db_next_row(_db_query,item,conversions)
|
||||
|
||||
DBQuery/proc/ErrorMsg() return _dm_db_error_msg(_db_query)
|
||||
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)
|
||||
if (!columns)
|
||||
columns = _dm_db_columns(_db_query,/DBColumn)
|
||||
return columns
|
||||
|
||||
DBQuery/proc/GetRowData()
|
||||
var/list/columns = Columns()
|
||||
var/list/results
|
||||
if(columns.len)
|
||||
if (columns.len)
|
||||
results = list()
|
||||
for(var/C in columns)
|
||||
results+=C
|
||||
for (var/C in columns)
|
||||
results += C
|
||||
var/DBColumn/cur_col = columns[C]
|
||||
results[C] = src.item[(cur_col.position+1)]
|
||||
results[C] = item[(cur_col.position+1)]
|
||||
return results
|
||||
|
||||
DBQuery/proc/Close()
|
||||
@@ -138,11 +157,49 @@ 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
|
||||
if (istext(column))
|
||||
column = columns.Find(column)
|
||||
if (!conversions)
|
||||
conversions = new/list(column)
|
||||
else if (conversions.len < column)
|
||||
conversions.len = column
|
||||
conversions[column] = conversion
|
||||
|
||||
/* Works similarly to the PDO object's Execute() method in PHP.
|
||||
* Insert a list of keys/values, it searches the SQL syntax for the keys,
|
||||
* and replaces them with sanitized versions of the values.
|
||||
* Can be called independently, or through dbcon.Execute(), where the list would be the first argument.
|
||||
* passNotFound controls whether or not is passes keys not found in the SQL query.
|
||||
* Keys are /case-sensitive/, be careful!
|
||||
* Returns the parsed SQL query upon completion.
|
||||
* - Skull132
|
||||
*/
|
||||
DBQuery/proc/parseArguments(var/query_to_parse = null, var/list/argument_list, var/pass_not_found = 0)
|
||||
if (!query_to_parse || !argument_list || !argument_list.len)
|
||||
return 0
|
||||
|
||||
for (var/placeholder in argument_list)
|
||||
if (!findtextEx(sql, placeholder))
|
||||
if (pass_not_found)
|
||||
continue
|
||||
else
|
||||
return 0
|
||||
|
||||
var/argument = argument_list[placeholder]
|
||||
|
||||
if (isnull(argument))
|
||||
argument = "NULL"
|
||||
else if (istext(argument))
|
||||
argument = dbcon.Quote(argument)
|
||||
else if (isnum(argument))
|
||||
argument = "'[argument]'"
|
||||
else
|
||||
return 0
|
||||
|
||||
query_to_parse = replacetextEx(sql, placeholder, argument)
|
||||
|
||||
return query_to_parse
|
||||
|
||||
|
||||
DBColumn
|
||||
var/name
|
||||
@@ -153,32 +210,45 @@ DBColumn
|
||||
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
|
||||
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
|
||||
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"
|
||||
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"
|
||||
|
||||
|
||||
#undef Default_Cursor
|
||||
|
||||
@@ -11,7 +11,7 @@ proc/sql_poll_population()
|
||||
log_game("SQL ERROR during population polling. Failed to connect.")
|
||||
else
|
||||
var/sqltime = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
|
||||
var/DBQuery/query = dbcon_old.NewQuery("INSERT INTO `tgstation`.`population` (`playercount`, `admincount`, `time`) VALUES ([playercount], [admincount], '[sqltime]')")
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO `ss13_population` (`playercount`, `admincount`, `time`) VALUES ([playercount], [admincount], '[sqltime]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during population polling. Error : \[[err]\]\n")
|
||||
@@ -53,7 +53,7 @@ proc/sql_report_death(var/mob/living/carbon/human/H)
|
||||
if(!dbcon.IsConnected())
|
||||
log_game("SQL ERROR during death reporting. Failed to connect.")
|
||||
else
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')")
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during death reporting. Error : \[[err]\]\n")
|
||||
@@ -87,7 +87,7 @@ proc/sql_report_cyborg_death(var/mob/living/silicon/robot/H)
|
||||
if(!dbcon.IsConnected())
|
||||
log_game("SQL ERROR during death reporting. Failed to connect.")
|
||||
else
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')")
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_death (name, byondkey, job, special, pod, tod, laname, lakey, gender, bruteloss, fireloss, brainloss, oxyloss, coord) VALUES ('[sqlname]', '[sqlkey]', '[sqljob]', '[sqlspecial]', '[sqlpod]', '[sqltime]', '[laname]', '[lakey]', '[H.gender]', [H.getBruteLoss()], [H.getFireLoss()], [H.brainloss], [H.getOxyLoss()], '[coord]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during death reporting. Error : \[[err]\]\n")
|
||||
@@ -118,7 +118,7 @@ proc/sql_commit_feedback()
|
||||
log_game("SQL ERROR during feedback reporting. Failed to connect.")
|
||||
else
|
||||
|
||||
var/DBQuery/max_query = dbcon.NewQuery("SELECT MAX(roundid) AS max_round_id FROM erro_feedback")
|
||||
var/DBQuery/max_query = dbcon.NewQuery("SELECT MAX(roundid) AS max_round_id FROM ss13_feedback")
|
||||
max_query.Execute()
|
||||
|
||||
var/newroundid
|
||||
@@ -138,7 +138,7 @@ proc/sql_commit_feedback()
|
||||
var/variable = item.get_variable()
|
||||
var/value = item.get_value()
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO erro_feedback (id, roundid, time, variable, value) VALUES (null, [newroundid], Now(), '[variable]', '[value]')")
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_feedback (id, roundid, time, variable, value) VALUES (null, [newroundid], Now(), '[variable]', '[value]')")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during death reporting. Error : \[[err]\]\n")
|
||||
|
||||
+60
-18
@@ -3,49 +3,91 @@
|
||||
var/list/whitelist = list()
|
||||
|
||||
/hook/startup/proc/loadWhitelist()
|
||||
if(config.usewhitelist)
|
||||
if (config.usewhitelist)
|
||||
load_whitelist()
|
||||
return 1
|
||||
|
||||
/proc/load_whitelist()
|
||||
whitelist = file2list(WHITELISTFILE)
|
||||
if(!whitelist.len) whitelist = null
|
||||
if (config.sql_whitelists)
|
||||
establish_db_connection()
|
||||
|
||||
if (!dbcon.IsConnected())
|
||||
//Continue with the old code if we have no database.
|
||||
error("Database connection failed while loading whitelists. Reverting to legacy system.")
|
||||
config.sql_whitelists = 0
|
||||
else
|
||||
return
|
||||
|
||||
whitelist = file2list(WHITELISTFILE)
|
||||
if (!whitelist.len)
|
||||
whitelist = null
|
||||
|
||||
/proc/check_whitelist(mob/M)
|
||||
if (config.sql_whitelists)
|
||||
var/head_of_staff_whitelist = 1
|
||||
if (M.client && M.client.whitelist_status)
|
||||
return (M.client.whitelist_status & head_of_staff_whitelist)
|
||||
|
||||
/proc/check_whitelist(mob/M /*, var/rank*/)
|
||||
if(!whitelist)
|
||||
return 0
|
||||
return ("[M.ckey]" in whitelist)
|
||||
else
|
||||
if (!whitelist)
|
||||
return 0
|
||||
return ("[M.ckey]" in whitelist)
|
||||
|
||||
/var/list/alien_whitelist = list()
|
||||
|
||||
/hook/startup/proc/loadAlienWhitelist()
|
||||
if(config.usealienwhitelist)
|
||||
if (config.usealienwhitelist)
|
||||
load_alienwhitelist()
|
||||
return 1
|
||||
|
||||
/proc/load_alienwhitelist()
|
||||
if (config.sql_whitelists)
|
||||
establish_db_connection()
|
||||
|
||||
if (!dbcon.IsConnected())
|
||||
//Continue with the old code if we have no database.
|
||||
error("Database connection failed while loading alien whitelists. Reverting to legacy system.")
|
||||
config.sql_whitelists = 0
|
||||
else
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT status_name, flag FROM ss13_whitelist_statuses")
|
||||
query.Execute()
|
||||
|
||||
while (query.NextRow())
|
||||
if (query.item[1] in whitelisted_species)
|
||||
whitelisted_species[query.item[1]] = text2num(query.item[2])
|
||||
|
||||
return
|
||||
|
||||
var/text = file2text("config/alienwhitelist.txt")
|
||||
if (!text)
|
||||
log_misc("Failed to load config/alienwhitelist.txt")
|
||||
else
|
||||
alien_whitelist = text2list(text, "\n")
|
||||
|
||||
//todo: admin aliens
|
||||
/proc/is_alien_whitelisted(mob/M, var/species)
|
||||
if(!config.usealienwhitelist)
|
||||
if (!config.usealienwhitelist)
|
||||
return 1
|
||||
if(species == "human" || species == "Human")
|
||||
return 1
|
||||
if(check_rights(R_ADMIN, 0))
|
||||
|
||||
if (!M || !species)
|
||||
return 0
|
||||
|
||||
if (lowertext(species) == "human")
|
||||
return 1
|
||||
|
||||
if(!alien_whitelist)
|
||||
return 0
|
||||
if(M && species)
|
||||
for (var/s in alien_whitelist)
|
||||
if(findtext(s,"[M.ckey] - [species]"))
|
||||
return 1
|
||||
if(findtext(s,"[M.ckey] - All"))
|
||||
return 1
|
||||
|
||||
if (config.sql_whitelists)
|
||||
if (M.client && M.client.whitelist_status)
|
||||
return (M.client.whitelist_status & whitelisted_species[species])
|
||||
else
|
||||
if (M && species)
|
||||
for (var/s in alien_whitelist)
|
||||
if (findtext(s,"[M.ckey] - [species]"))
|
||||
return 1
|
||||
if (findtext(s,"[M.ckey] - All"))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
#undef WHITELISTFILE
|
||||
|
||||
@@ -50,7 +50,7 @@ datum/book_manager/proc/freeid()
|
||||
if(!dbcon.IsConnected())
|
||||
alert("Connection to Archive has been severed. Aborting.")
|
||||
else
|
||||
var/DBQuery/query = dbcon.NewQuery("DELETE FROM library WHERE id=[isbn]")
|
||||
var/DBQuery/query = dbcon.NewQuery("DELETE FROM ss13_library WHERE id=[isbn]")
|
||||
if(!query.Execute())
|
||||
usr << query.ErrorMsg()
|
||||
dbcon.Disconnect()
|
||||
|
||||
@@ -193,11 +193,6 @@ var/sqlport = "3306"
|
||||
var/sqldb = "tgstation"
|
||||
var/sqllogin = "root"
|
||||
var/sqlpass = ""
|
||||
|
||||
// Feedback gathering sql connection
|
||||
var/sqlfdbkdb = "test"
|
||||
var/sqlfdbklogin = "root"
|
||||
var/sqlfdbkpass = ""
|
||||
var/sqllogging = 0 // Should we log deaths, population stats, etc.?
|
||||
|
||||
// Forum MySQL configuration. (for use with forum account/key authentication)
|
||||
@@ -218,7 +213,6 @@ var/custom_event_msg = null
|
||||
// Database connections. A connection is established on world creation.
|
||||
// Ideally, the connection dies when the server restarts (After feedback logging.).
|
||||
var/DBConnection/dbcon = new() // Feedback database (New database)
|
||||
var/DBConnection/dbcon_old = new() // /tg/station database (Old database) -- see the files in the SQL folder for information on what goes where.
|
||||
|
||||
// Reference list for disposal sort junctions. Filled up by sorting junction's New()
|
||||
/var/list/tagger_locations = list()
|
||||
|
||||
@@ -44,7 +44,7 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration =
|
||||
computerid = bancid
|
||||
ip = banip
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_player WHERE ckey = '[ckey]'")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM ss13_player WHERE ckey = '[ckey]'")
|
||||
query.Execute()
|
||||
var/validckey = 0
|
||||
if(query.NextRow())
|
||||
@@ -79,7 +79,7 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration =
|
||||
|
||||
reason = sql_sanitize_text(reason)
|
||||
|
||||
var/sql = "INSERT INTO erro_ban (`id`,`bantime`,`serverip`,`bantype`,`reason`,`job`,`duration`,`rounds`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`,`edits`,`unbanned`,`unbanned_datetime`,`unbanned_ckey`,`unbanned_computerid`,`unbanned_ip`) VALUES (null, Now(), '[serverip]', '[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], [(rounds)?"[rounds]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', '[ip]', '[a_ckey]', '[a_computerid]', '[a_ip]', '[who]', '[adminwho]', '', null, null, null, null, null)"
|
||||
var/sql = "INSERT INTO ss13_ban (`id`,`bantime`,`serverip`,`bantype`,`reason`,`job`,`duration`,`rounds`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`,`edits`,`unbanned`,`unbanned_datetime`,`unbanned_ckey`,`unbanned_computerid`,`unbanned_ip`) VALUES (null, Now(), '[serverip]', '[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], [(rounds)?"[rounds]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', '[ip]', '[a_ckey]', '[a_computerid]', '[a_ip]', '[who]', '[adminwho]', '', null, null, null, null, null)"
|
||||
var/DBQuery/query_insert = dbcon.NewQuery(sql)
|
||||
query_insert.Execute()
|
||||
usr << "\blue Ban saved to database."
|
||||
@@ -118,7 +118,7 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
|
||||
else
|
||||
bantype_sql = "bantype = '[bantype_str]'"
|
||||
|
||||
var/sql = "SELECT id FROM erro_ban WHERE ckey = '[ckey]' AND [bantype_sql] AND (unbanned is null OR unbanned = false)"
|
||||
var/sql = "SELECT id FROM ss13_ban WHERE ckey = '[ckey]' AND [bantype_sql] AND (unbanned is null OR unbanned = false)"
|
||||
if(job)
|
||||
sql += " AND job = '[job]'"
|
||||
|
||||
@@ -159,7 +159,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
|
||||
usr << "Cancelled"
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, duration, reason FROM erro_ban WHERE id = [banid]")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, duration, reason FROM ss13_ban WHERE id = [banid]")
|
||||
query.Execute()
|
||||
|
||||
var/eckey = usr.ckey //Editing admin ckey
|
||||
@@ -187,7 +187,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
|
||||
usr << "Cancelled"
|
||||
return
|
||||
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE erro_ban SET reason = '[value]', edits = CONCAT(edits,'- [eckey] changed ban reason from <cite><b>\\\"[reason]\\\"</b></cite> to <cite><b>\\\"[value]\\\"</b></cite><BR>') WHERE id = [banid]")
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE ss13_ban SET reason = '[value]', edits = CONCAT(edits,'- [eckey] changed ban reason from <cite><b>\\\"[reason]\\\"</b></cite> to <cite><b>\\\"[value]\\\"</b></cite><BR>') WHERE id = [banid]")
|
||||
update_query.Execute()
|
||||
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s reason from [reason] to [value]",1)
|
||||
if("duration")
|
||||
@@ -197,7 +197,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
|
||||
usr << "Cancelled"
|
||||
return
|
||||
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE erro_ban SET duration = [value], edits = CONCAT(edits,'- [eckey] changed ban duration from [duration] to [value]<br>'), expiration_time = DATE_ADD(bantime, INTERVAL [value] MINUTE) WHERE id = [banid]")
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE ss13_ban SET duration = [value], edits = CONCAT(edits,'- [eckey] changed ban duration from [duration] to [value]<br>'), expiration_time = DATE_ADD(bantime, INTERVAL [value] MINUTE) WHERE id = [banid]")
|
||||
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s duration from [duration] to [value]",1)
|
||||
update_query.Execute()
|
||||
if("unban")
|
||||
@@ -215,7 +215,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
||||
|
||||
if(!check_rights(R_BAN)) return
|
||||
|
||||
var/sql = "SELECT ckey FROM erro_ban WHERE id = [id]"
|
||||
var/sql = "SELECT ckey FROM ss13_ban WHERE id = [id]"
|
||||
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
@@ -245,7 +245,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
||||
var/unban_computerid = src.owner:computer_id
|
||||
var/unban_ip = src.owner:address
|
||||
|
||||
var/sql_update = "UPDATE erro_ban SET unbanned = 1, unbanned_datetime = Now(), unbanned_ckey = '[unban_ckey]', unbanned_computerid = '[unban_computerid]', unbanned_ip = '[unban_ip]' WHERE id = [id]"
|
||||
var/sql_update = "UPDATE ss13_ban SET unbanned = 1, unbanned_datetime = Now(), unbanned_ckey = '[unban_ckey]', unbanned_computerid = '[unban_computerid]', unbanned_ip = '[unban_ip]' WHERE id = [id]"
|
||||
message_admins("[key_name_admin(usr)] has lifted [pckey]'s ban.",1)
|
||||
|
||||
var/DBQuery/query_update = dbcon.NewQuery(sql_update)
|
||||
@@ -399,7 +399,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
||||
else
|
||||
bantypesearch += "'PERMABAN' "
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, edits, ip, computerid FROM erro_ban WHERE 1 [playersearch] [adminsearch] [ipsearch] [cidsearch] [bantypesearch] ORDER BY bantime DESC LIMIT 100")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, edits, ip, computerid FROM ss13_ban WHERE 1 [playersearch] [adminsearch] [ipsearch] [cidsearch] [bantypesearch] ORDER BY bantime DESC LIMIT 100")
|
||||
select_query.Execute()
|
||||
|
||||
var/now = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss") // MUST BE the same format as SQL gives us the dates in, and MUST be least to most specific (i.e. year, month, day not day, month, year)
|
||||
|
||||
@@ -52,7 +52,7 @@ world/IsBanned(key,address,computer_id)
|
||||
failedcid = 0
|
||||
cidquery = " OR computerid = '[computer_id]' "
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM erro_ban WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM ss13_ban WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
|
||||
|
||||
query.Execute()
|
||||
|
||||
|
||||
+51
-39
@@ -62,6 +62,7 @@ proc/admin_notice(var/message, var/rights)
|
||||
<b>Mob type</b> = [M.type]<br><br>
|
||||
<A href='?src=\ref[src];boot2=\ref[M]'>Kick</A> |
|
||||
<A href='?_src_=holder;warn=[M.ckey]'>Warn</A> |
|
||||
<a href='?src=\ref[src];warnsearchckey=[M.ckey]'>Warnings</a> |
|
||||
<A href='?src=\ref[src];newban=\ref[M]'>Ban</A> |
|
||||
<A href='?src=\ref[src];jobban2=\ref[M]'>Jobban</A> |
|
||||
<A href='?src=\ref[src];notes=show;mob=\ref[M]'>Notes</A>
|
||||
@@ -69,6 +70,7 @@ proc/admin_notice(var/message, var/rights)
|
||||
|
||||
if(M.client)
|
||||
body += "| <A HREF='?src=\ref[src];sendtoprison=\ref[M]'>Prison</A> | "
|
||||
body += "<a href='?src=\ref[src];admin_wind_player=\ref[M]'>Wind</a>"
|
||||
var/muted = M.client.prefs.muted
|
||||
body += {"<br><b>Mute: </b>
|
||||
\[<A href='?src=\ref[src];mute=\ref[M];mute_type=[MUTE_IC]'><font color='[(muted & MUTE_IC)?"red":"blue"]'>IC</font></a> |
|
||||
@@ -220,7 +222,12 @@ proc/admin_notice(var/message, var/rights)
|
||||
if (!istype(src,/datum/admins))
|
||||
usr << "Error: you are not an admin!"
|
||||
return
|
||||
PlayerNotesPage(1)
|
||||
if (!check_rights(R_ADMIN|R_MOD))
|
||||
return
|
||||
if (config.ban_legacy_system)
|
||||
PlayerNotesPage(1)
|
||||
else
|
||||
show_notes_sql()
|
||||
|
||||
/datum/admins/proc/PlayerNotesPage(page)
|
||||
var/dat = "<B>Player notes</B><HR>"
|
||||
@@ -278,45 +285,47 @@ proc/admin_notice(var/message, var/rights)
|
||||
if (!istype(src,/datum/admins))
|
||||
usr << "Error: you are not an admin!"
|
||||
return
|
||||
var/dat = "<html><head><title>Info on [key]</title></head>"
|
||||
dat += "<body>"
|
||||
|
||||
var/p_age = "unknown"
|
||||
for(var/client/C in clients)
|
||||
if(C.ckey == key)
|
||||
p_age = C.player_age
|
||||
break
|
||||
dat +="<span style='color:#000000; font-weight: bold'>Player age: [p_age]</span><br>"
|
||||
if (config.ban_legacy_system)
|
||||
var/dat = "<html><head><title>Info on [key]</title></head>"
|
||||
dat += "<body>"
|
||||
|
||||
var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav")
|
||||
var/list/infos
|
||||
info >> infos
|
||||
if(!infos)
|
||||
dat += "No information found on the given key.<br>"
|
||||
var/p_age = "unknown"
|
||||
for(var/client/C in clients)
|
||||
if(C.ckey == key)
|
||||
p_age = C.player_age
|
||||
break
|
||||
dat +="<span style='color:#000000; font-weight: bold'>Player age: [p_age]</span><br>"
|
||||
|
||||
var/savefile/info = new("data/player_saves/[copytext(key, 1, 2)]/[key]/info.sav")
|
||||
var/list/infos
|
||||
info >> infos
|
||||
if(!infos)
|
||||
dat += "No information found on the given key.<br>"
|
||||
else
|
||||
var/update_file = 0
|
||||
var/i = 0
|
||||
for(var/datum/player_info/I in infos)
|
||||
i += 1
|
||||
if(!I.timestamp)
|
||||
I.timestamp = "Pre-4/3/2012"
|
||||
update_file = 1
|
||||
if(!I.rank)
|
||||
I.rank = "N/A"
|
||||
update_file = 1
|
||||
dat += "<font color=#008800>[I.content]</font> <i>by [I.author] ([I.rank])</i> on <i><font color=blue>[I.timestamp]</i></font> "
|
||||
if(I.author == usr.key || I.author == "Adminbot" || ishost(usr))
|
||||
dat += "<A href='?src=\ref[src];remove_player_info=[key];remove_index=[i]'>Remove</A>"
|
||||
dat += "<br><br>"
|
||||
if(update_file) info << infos
|
||||
|
||||
dat += "<br>"
|
||||
dat += "<A href='?src=\ref[src];add_player_info=[key]'>Add Comment</A><br>"
|
||||
|
||||
dat += "</body></html>"
|
||||
usr << browse(dat, "window=adminplayerinfo;size=480x480")
|
||||
else
|
||||
var/update_file = 0
|
||||
var/i = 0
|
||||
for(var/datum/player_info/I in infos)
|
||||
i += 1
|
||||
if(!I.timestamp)
|
||||
I.timestamp = "Pre-4/3/2012"
|
||||
update_file = 1
|
||||
if(!I.rank)
|
||||
I.rank = "N/A"
|
||||
update_file = 1
|
||||
dat += "<font color=#008800>[I.content]</font> <i>by [I.author] ([I.rank])</i> on <i><font color=blue>[I.timestamp]</i></font> "
|
||||
if(I.author == usr.key || I.author == "Adminbot" || ishost(usr))
|
||||
dat += "<A href='?src=\ref[src];remove_player_info=[key];remove_index=[i]'>Remove</A>"
|
||||
dat += "<br><br>"
|
||||
if(update_file) info << infos
|
||||
|
||||
dat += "<br>"
|
||||
dat += "<A href='?src=\ref[src];add_player_info=[key]'>Add Comment</A><br>"
|
||||
|
||||
dat += "</body></html>"
|
||||
usr << browse(dat, "window=adminplayerinfo;size=480x480")
|
||||
|
||||
|
||||
show_notes_sql(key)
|
||||
|
||||
/datum/admins/proc/access_news_network() //MARKER
|
||||
set category = "Fun"
|
||||
@@ -1408,16 +1417,19 @@ proc/admin_notice(var/message, var/rights)
|
||||
|
||||
/datum/admins/proc/paralyze_mob(mob/living/H as mob)
|
||||
set category = "Admin"
|
||||
set name = "Toggle Paralyze"
|
||||
set name = "Toggle Wind"
|
||||
set desc = "Paralyzes a player. Or unparalyses them."
|
||||
|
||||
var/msg
|
||||
|
||||
if(check_rights(R_ADMIN))
|
||||
if(check_rights(R_ADMIN|R_MOD))
|
||||
if (H.paralysis == 0)
|
||||
H.paralysis = 8000
|
||||
msg = "has paralyzed [key_name(H)]."
|
||||
H.visible_message("<font color='#002eb8'><b>OOC Information:</b></font> <font color='red'>[src] has been winded by a member of staff! Please freeze all roleplay involving their character until the matter is resolved! Adminmhelp if you have further questions.</font>", "<font color='red'><b>You have been winded by a member of staff! Please stand by until they contact you!</b></font>")
|
||||
else
|
||||
H.paralysis = 0
|
||||
msg = "has unparalyzed [key_name(H)]."
|
||||
H.visible_message("<font color='#002eb8'><b>OOC Information:</b></font> <font color='green'>[src] has been unwinded by a member of staff!</font>", "<font color='red'><b>You have been unwinded by a member of staff!</b></font>")
|
||||
log_and_message_admins(msg)
|
||||
feedback_add_details("admin_verb", "WIND")
|
||||
|
||||
@@ -109,7 +109,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
|
||||
load_admins()
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, rank, level, flags FROM erro_admin")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, rank, level, flags FROM ss13_admin")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
var/ckey = query.item[1]
|
||||
|
||||
@@ -96,7 +96,8 @@ var/list/admin_verbs_admin = list(
|
||||
)
|
||||
var/list/admin_verbs_ban = list(
|
||||
/client/proc/unban_panel,
|
||||
/client/proc/jobbans
|
||||
/client/proc/jobbans,
|
||||
/client/proc/warning_panel
|
||||
)
|
||||
var/list/admin_verbs_sounds = list(
|
||||
/client/proc/play_local_sound,
|
||||
@@ -514,48 +515,6 @@ var/list/admin_verbs_mentor = list(
|
||||
message_admins("[key_name_admin(usr)] has turned stealth mode [holder.fakekey ? "ON" : "OFF"]", 1)
|
||||
feedback_add_details("admin_verb","SM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
#define MAX_WARNS 3
|
||||
#define AUTOBANTIME 10
|
||||
|
||||
/client/proc/warn(warned_ckey)
|
||||
if(!check_rights(R_ADMIN)) return
|
||||
|
||||
if(!warned_ckey || !istext(warned_ckey)) return
|
||||
if(warned_ckey in admin_datums)
|
||||
usr << "<font color='red'>Error: warn(): You can't warn admins.</font>"
|
||||
return
|
||||
|
||||
var/datum/preferences/D
|
||||
var/client/C = directory[warned_ckey]
|
||||
if(C) D = C.prefs
|
||||
else D = preferences_datums[warned_ckey]
|
||||
|
||||
if(!D)
|
||||
src << "<font color='red'>Error: warn(): No such ckey found.</font>"
|
||||
return
|
||||
|
||||
if(++D.warns >= MAX_WARNS) //uh ohhhh...you'reee iiiiin trouuuubble O:)
|
||||
ban_unban_log_save("[ckey] warned [warned_ckey], resulting in a [AUTOBANTIME] minute autoban.")
|
||||
if(C)
|
||||
message_admins("[key_name_admin(src)] has warned [key_name_admin(C)] resulting in a [AUTOBANTIME] minute ban.")
|
||||
C << "<font color='red'><BIG><B>You have been autobanned due to a warning by [ckey].</B></BIG><br>This is a temporary ban, it will be removed in [AUTOBANTIME] minutes."
|
||||
qdel(C)
|
||||
else
|
||||
message_admins("[key_name_admin(src)] has warned [warned_ckey] resulting in a [AUTOBANTIME] minute ban.")
|
||||
AddBan(warned_ckey, D.last_id, "Autobanning due to too many formal warnings", ckey, 1, AUTOBANTIME)
|
||||
feedback_inc("ban_warn",1)
|
||||
else
|
||||
if(C)
|
||||
C << "<font color='red'><BIG><B>You have been formally warned by an administrator.</B></BIG><br>Further warnings will result in an autoban.</font>"
|
||||
message_admins("[key_name_admin(src)] has warned [key_name_admin(C)]. They have [MAX_WARNS-D.warns] strikes remaining.")
|
||||
else
|
||||
message_admins("[key_name_admin(src)] has warned [warned_ckey] (DC). They have [MAX_WARNS-D.warns] strikes remaining.")
|
||||
|
||||
feedback_add_details("admin_verb","WARN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
#undef MAX_WARNS
|
||||
#undef AUTOBANTIME
|
||||
|
||||
/client/proc/drop_bomb() // Some admin dickery that can probably be done better -- TLE
|
||||
set category = "Special Verbs"
|
||||
set name = "Drop Bomb"
|
||||
|
||||
@@ -73,7 +73,7 @@ DEBUG
|
||||
return
|
||||
|
||||
//Job permabans
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, job FROM erro_ban WHERE bantype = 'JOB_PERMABAN' AND isnull(unbanned)")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, job FROM ss13_ban WHERE bantype = 'JOB_PERMABAN' AND isnull(unbanned)")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
@@ -83,7 +83,7 @@ DEBUG
|
||||
jobban_keylist.Add("[ckey] - [job]")
|
||||
|
||||
//Job tempbans
|
||||
var/DBQuery/query1 = dbcon.NewQuery("SELECT ckey, job FROM erro_ban WHERE bantype = 'JOB_TEMPBAN' AND isnull(unbanned) AND expiration_time > Now()")
|
||||
var/DBQuery/query1 = dbcon.NewQuery("SELECT ckey, job FROM ss13_ban WHERE bantype = 'JOB_TEMPBAN' AND isnull(unbanned) AND expiration_time > Now()")
|
||||
query1.Execute()
|
||||
|
||||
while(query1.NextRow())
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
if(!istext(adm_ckey) || !istext(new_rank))
|
||||
return
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id FROM erro_admin WHERE ckey = '[adm_ckey]'")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id FROM ss13_admin WHERE ckey = '[adm_ckey]'")
|
||||
select_query.Execute()
|
||||
|
||||
var/new_admin = 1
|
||||
@@ -81,16 +81,16 @@
|
||||
admin_id = text2num(select_query.item[1])
|
||||
|
||||
if(new_admin)
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO `erro_admin` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO `ss13_admin` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
|
||||
insert_query.Execute()
|
||||
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_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/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new admin [adm_ckey] to rank [new_rank]');")
|
||||
log_query.Execute()
|
||||
usr << "\blue New admin added."
|
||||
else
|
||||
if(!isnull(admin_id) && isnum(admin_id))
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET rank = '[new_rank]' WHERE id = [admin_id]")
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `ss13_admin` SET rank = '[new_rank]' WHERE id = [admin_id]")
|
||||
insert_query.Execute()
|
||||
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_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/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Edited the rank of [adm_ckey] to [new_rank]');")
|
||||
log_query.Execute()
|
||||
usr << "\blue Admin rank changed."
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
if(!istext(adm_ckey) || !isnum(new_permission))
|
||||
return
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, flags FROM erro_admin WHERE ckey = '[adm_ckey]'")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, flags FROM ss13_admin WHERE ckey = '[adm_ckey]'")
|
||||
select_query.Execute()
|
||||
|
||||
var/admin_id
|
||||
@@ -136,14 +136,14 @@
|
||||
return
|
||||
|
||||
if(admin_rights & new_permission) //This admin already has this permission, so we are removing it.
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET flags = [admin_rights & ~new_permission] WHERE id = [admin_id]")
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `ss13_admin` SET flags = [admin_rights & ~new_permission] WHERE id = [admin_id]")
|
||||
insert_query.Execute()
|
||||
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
|
||||
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Removed permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]');")
|
||||
log_query.Execute()
|
||||
usr << "\blue Permission removed."
|
||||
else //This admin doesn't have this permission, so we are adding it.
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `erro_admin` SET flags = '[admin_rights | new_permission]' WHERE id = [admin_id]")
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("UPDATE `ss13_admin` SET flags = '[admin_rights | new_permission]' WHERE id = [admin_id]")
|
||||
insert_query.Execute()
|
||||
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`erro_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]')")
|
||||
var/DBQuery/log_query = dbcon.NewQuery("INSERT INTO `test`.`ss13_admin_log` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added permission [rights2text(new_permission)] (flag = [new_permission]) to admin [adm_ckey]')")
|
||||
log_query.Execute()
|
||||
usr << "\blue Permission added."
|
||||
@@ -0,0 +1,262 @@
|
||||
//System will now support SQL pulls for fetching player notes.
|
||||
//Yay!
|
||||
|
||||
/proc/notes_add_sql(var/player_ckey, var/note, var/mob/user, var/player_address, var/player_computerid)
|
||||
if(!player_ckey || !note)
|
||||
return
|
||||
|
||||
var/list/query_details = list(":ckey" = player_ckey, ":address" = player_address ? player_address : null, ":computer_id" = player_computerid ? player_computerid : null, ":a_ckey" = null, ":note" = note)
|
||||
|
||||
if (!user)
|
||||
query_details[":a_ckey"] = "Adminbot"
|
||||
else
|
||||
query_details[":a_ckey"] = user.ckey
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
alert("SQL connection failed while trying to add a note!")
|
||||
return
|
||||
|
||||
if (!player_address || !player_computerid)
|
||||
var/DBQuery/init_query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = :ckey")
|
||||
init_query.Execute(list(":ckey" = player_ckey))
|
||||
if (init_query.NextRow())
|
||||
if (!query_details[":address"])
|
||||
query_details[":address"] = init_query.item[1]
|
||||
if (!query_details[":computer_id"])
|
||||
query_details[":computer_id"] = init_query.item[2]
|
||||
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_notes (id, adddate, ckey, ip, computerid, a_ckey, content) VALUES (null, Now(), :ckey, :address, :computer_id, :a_ckey, :note)")
|
||||
insert_query.Execute(query_details)
|
||||
|
||||
message_admins("\blue [key_name_admin(user)] has edited [player_ckey]'s notes.")
|
||||
log_admin("[key_name(user)] has edited [player_ckey]'s notes.")
|
||||
|
||||
/proc/notes_edit_sql(var/note_id, var/note_edit)
|
||||
if (!note_id || !note_edit)
|
||||
return
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
error("SQL connection failed while attempting to delete a note!")
|
||||
return
|
||||
|
||||
var/count = 0 //failsafe from unban procs
|
||||
var/ckey
|
||||
var/note
|
||||
|
||||
var/DBQuery/init_query = dbcon.NewQuery("SELECT ckey, content FROM ss13_notes WHERE id = :note_id")
|
||||
init_query.Execute(list(":note_id" = note_id))
|
||||
while (init_query.NextRow())
|
||||
ckey = init_query.item[1]
|
||||
note = init_query.item[2]
|
||||
count++
|
||||
|
||||
if (count == 0)
|
||||
usr << "\red Database update failed due to a note id not being present in the database."
|
||||
error("Database update failed due to a note id not being present in the database.")
|
||||
return
|
||||
|
||||
if (count > 1)
|
||||
usr << "\red Database update failed due to multiple notes having the same ID. Contact the database admin."
|
||||
error("Database update failed due to multiple notes having the same ID. Contact the database admin.")
|
||||
return
|
||||
|
||||
switch (note_edit)
|
||||
if ("delete")
|
||||
if(alert("Delete this note?", "Delete?", "Yes", "No") == "Yes")
|
||||
var/DBQuery/deletequery = dbcon.NewQuery("UPDATE ss13_notes SET visible = 0 WHERE id = :note_id")
|
||||
deletequery.Execute(list(":note_id" = note_id))
|
||||
|
||||
message_admins("\blue [key_name_admin(usr)] deleted one of [ckey]'s notes.")
|
||||
log_admin("[key_name(usr)] deleted one of [ckey]'s notes.")
|
||||
else
|
||||
usr << "Cancelled"
|
||||
return
|
||||
if ("content")
|
||||
var/new_content = input("Edit this note's contents.", "New Contents", note, null) as null|text
|
||||
if (!new_content)
|
||||
usr << "Cancelled"
|
||||
return
|
||||
var/DBQuery/editquery = dbcon.NewQuery("UPDATE ss13_notes SET content = :new_content, lasteditor = :a_ckey, lasteditdate = Now(), edited = 1 WHERE id = :note_id")
|
||||
editquery.Execute(list(":new_conent" = new_content, ":a_ckey" = usr.client.ckey, ":note_id" = note_id))
|
||||
|
||||
/datum/admins/proc/show_notes_sql(var/player_ckey = null, var/admin_ckey = null)
|
||||
if (!check_rights(R_ADMIN|R_MOD))
|
||||
return
|
||||
|
||||
if (admin_ckey == "Adminbot")
|
||||
usr << "Adminbot is not an actual admin. You were lied to."
|
||||
//The fucking size of this request would be astronomical. Please do not!
|
||||
return
|
||||
|
||||
player_ckey = ckey(player_ckey)
|
||||
admin_ckey = ckey(admin_ckey)
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
error("SQL connection failed while attempting to view a player's notes!")
|
||||
return
|
||||
|
||||
var/dat = "<div align='center'><h3>Notes Look-up Panel</h3><br>"
|
||||
|
||||
//Totally not stealing code from the DB_ban_panel
|
||||
|
||||
dat += "<form method='GET' action='?src=\ref[src]'><b>Search:</b> "
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<b>Ckey:</b> <input type='text' name='notessearchckey' value='[player_ckey]'>"
|
||||
dat += "<b>Admin ckey:</b> <input type='text' name='notessearchadmin' value='[admin_ckey]'>"
|
||||
dat += "<input type='submit' value='search'>"
|
||||
dat += "</form></div>"
|
||||
|
||||
dat += "<table width='90%' bgcolor='#e3e3e3' cellpadding='5' cellspacing='0' align='center'>"
|
||||
dat += "<tr>"
|
||||
dat += "<th width='10%'>ISSUED TO</th>"
|
||||
dat += "<th width='10%'>ISSUED BY</th>"
|
||||
dat += "<th width='20%'>TIME ISSUED</th>"
|
||||
dat += "<th width='50%'>CONTENT</th>"
|
||||
dat += "</tr>"
|
||||
|
||||
if (player_ckey)
|
||||
var/list/query_details = list(":player_ckey" = player_ckey)
|
||||
|
||||
dat += "<tr><td align='center' colspan='4' bgcolor='white'><b><a href='?src=\ref[src];add_player_info=[player_ckey]'>Add Note</a></b></td></tr>"
|
||||
|
||||
var/DBQuery/init_query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = :player_ckey")
|
||||
init_query.Execute(query_details)
|
||||
if (init_query.NextRow())
|
||||
query_details += ":player_address"
|
||||
query_details += ":player_computerid"
|
||||
query_details[":player_address"] = init_query.item[1]
|
||||
query_details[":player_computerid"] = init_query.item[2]
|
||||
|
||||
var/query_content = "SELECT id, adddate, ckey, a_ckey, content, edited, lasteditor, lasteditdate FROM ss13_notes WHERE ckey = :player_ckey AND visible = '1'"
|
||||
|
||||
if (query_details[":player_address"])
|
||||
query_content += " OR ip = :player_address AND visible = '1'"
|
||||
if (query_details[":player_computerid"])
|
||||
query_content += " OR computerid = :player_computerid AND visible = '1'"
|
||||
|
||||
query_content += " ORDER BY adddate ASC"
|
||||
var/DBQuery/query = dbcon.NewQuery(query_content)
|
||||
query.Execute(query_details, 1)
|
||||
|
||||
while (query.NextRow())
|
||||
var/id = text2num(query.item[1])
|
||||
var/date = query.item[2]
|
||||
var/p_ckey = query.item[3]
|
||||
var/a_ckey = query.item[4]
|
||||
var/content = query.item[5]
|
||||
var/edited = text2num(query.item[6])
|
||||
|
||||
if (admin_ckey && ckey(a_ckey) != ckey(admin_ckey))
|
||||
continue
|
||||
else
|
||||
dat += "<tr bgcolor='#ffeeee'><td align='center'><b>[p_ckey]</b></td><td align='center'><b>[a_ckey]</b></td><td align='center'>[date]</td><td align='center'>[content]</td></tr>"
|
||||
if (edited)
|
||||
var/lasteditor = query.item[7]
|
||||
var/editdate = query.item[8]
|
||||
dat += "<tr><td align='center' colspan='4'><b>Note last edited: [editdate], by: [lasteditor].</b></td></tr>"
|
||||
dat += "<tr><td align='center' colspan='4'><b>(<a href=\"byond://?src=\ref[src];dbnoteedit=delete;dbnote_id=[id]\">Delete</a>) (<a href=\"byond://?src=\ref[src];dbnoteedit=content;dbnote_id=[id]\">Edit</a>)</b></td></tr>"
|
||||
dat += "<tr><td colspan='4' bgcolor='white'> </td></tr>"
|
||||
|
||||
else if (admin_ckey && !player_ckey)
|
||||
var/aquery_content = "SELECT id, adddate, ckey, content, edited, lasteditor, lasteditdate FROM ss13_notes WHERE a_ckey = :a_ckey AND visible = '1' ORDER BY adddate ASC"
|
||||
var/DBQuery/admin_query = dbcon.NewQuery(aquery_content)
|
||||
admin_query.Execute(list(":a_ckey" = admin_ckey))
|
||||
|
||||
while (admin_query.NextRow())
|
||||
var/id = text2num(admin_query.item[1])
|
||||
var/date = admin_query.item[2]
|
||||
var/p_ckey = admin_query.item[3]
|
||||
var/content = admin_query.item[4]
|
||||
var/edited = text2num(admin_query.item[5])
|
||||
|
||||
dat += "<tr bgcolor='#ffeeee'><td align='center'><b>[p_ckey]</b></td><td align='center'><b>[admin_ckey]</b></td><td align='center'>[date]</td><td align='center'>[content]</td></tr>"
|
||||
if (edited)
|
||||
var/lasteditor = admin_query.item[6]
|
||||
var/editdate = admin_query.item[7]
|
||||
dat += "<tr><td align='center' colspan='4'><b>Note last edited: [editdate], by: [lasteditor].</b></td></tr>"
|
||||
dat += "<tr><td align='center' colspan='4'><b>(<a href=\"byond://?src=\ref[src];dbnoteedit=delete;dbnote_id=[id]\">Delete</a>) (<a href=\"byond://?src=\ref[src];dbnoteedit=content;dbnote_id=[id]\">Edit</a>)</b></td></tr>"
|
||||
dat += "<tr><td colspan='4' bgcolor='white'> </td></tr>"
|
||||
|
||||
dat += "</table>"
|
||||
usr << browse(dat,"window=lookupnotes;size=900x500")
|
||||
|
||||
/*/proc/notes_transfer()
|
||||
msg_scopes("Locating master list.")
|
||||
var/savefile/note_list = new("data/player_notes.sav")
|
||||
var/list/note_keys
|
||||
note_list >> note_keys
|
||||
|
||||
msg_scopes("Establishing DB connection!")
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
msg_scopes("No DB connection!")
|
||||
return
|
||||
|
||||
for(var/t in note_keys)
|
||||
var/IP = null
|
||||
var/CID = null
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = '[t]'")
|
||||
query.Execute()
|
||||
if(query.NextRow())
|
||||
IP = query.item[1]
|
||||
CID = query.item[2]
|
||||
|
||||
var/savefile/info = new("data/player_saves/[copytext(t, 1, 2)]/[t]/info.sav")
|
||||
var/list/infos
|
||||
info >> infos
|
||||
|
||||
for(var/datum/player_info/I in infos)
|
||||
var/a_ckey = sanitizeSQL(I.author)
|
||||
var/timeY = copytext(I.timestamp, findtext(I.timestamp, "of") + 3)
|
||||
var/timeM
|
||||
var/timeD = copytext(I.timestamp, findtext(I.timestamp, " ", 6) + 1, findtext(I.timestamp, " ", 6) + 3)
|
||||
if(findtext(timeD, "s") || findtext(timeD, "n") || findtext(timeD, "r") || findtext(timeD, "t"))
|
||||
timeD = "0[copytext(timeD, 1, 2)]"
|
||||
|
||||
// msg_scopes("Timestamp: [I.timestamp].")
|
||||
var/temp = copytext(I.timestamp, 6, findtext(I.timestamp, " ", 6))
|
||||
// msg_scopes("The day? [timeD].")
|
||||
// msg_scopes("The month? [temp].")
|
||||
// msg_scopes("The year? [timeY].")
|
||||
switch(temp)
|
||||
if("January")
|
||||
timeM = "01"
|
||||
if("February")
|
||||
timeM = "02"
|
||||
if("March")
|
||||
timeM = "03"
|
||||
if("April")
|
||||
timeM = "04"
|
||||
if("May")
|
||||
timeM = "05"
|
||||
if("June")
|
||||
timeM = "06"
|
||||
if("July")
|
||||
timeM = "07"
|
||||
if("August")
|
||||
timeM = "08"
|
||||
if("September")
|
||||
timeM = "09"
|
||||
if("October")
|
||||
timeM = "10"
|
||||
if("November")
|
||||
timeM = "11"
|
||||
if("December")
|
||||
timeM = "12"
|
||||
|
||||
var/DTG = "[timeY]-[timeM]-[timeD] 00:00:00"
|
||||
// msg_scopes("Full DTG: [DTG]")
|
||||
var/insertionstuff
|
||||
if(IP && CID)
|
||||
insertionstuff = "INSERT INTO ss13_notes (id, adddate, ckey, ip, computerid, a_ckey, content) VALUES (null, '[DTG]', '[t]', '[IP]', '[CID]', '[a_ckey]', '[I.content]')"
|
||||
else
|
||||
insertionstuff = "INSERT INTO ss13_notes (id, adddate, ckey, ip, computerid, a_ckey, content) VALUES (null, '[DTG]', '[t]', null, null, '[a_ckey]', '[I.content]')"
|
||||
var/DBQuery/insertquery = dbcon.NewQuery(insertionstuff)
|
||||
insertquery.Execute()
|
||||
if(insertquery.ErrorMsg())
|
||||
msg_scopes(insertquery.ErrorMsg())
|
||||
else
|
||||
msg_scopes("Transfer successful.")*/
|
||||
@@ -82,6 +82,7 @@
|
||||
body += "<a href='?src=\ref[usr];priv_msg=\ref"+ref+"'>PM</a> - "
|
||||
body += "<a href='?src=\ref[src];subtlemessage="+ref+"'>SM</a> - "
|
||||
body += "<a href='?src=\ref[src];adminplayerobservejump="+ref+"'>JMP</a><br>"
|
||||
body += "<a hreF='?src=\ref[src];admin_wind_player="+ref+"'>WIND</a><br>"
|
||||
if(antagonist > 0)
|
||||
body += "<font size='2'><a href='?src=\ref[src];check_antagonist=1'><font color='red'><b>Antagonist</b></font></a></font>";
|
||||
|
||||
|
||||
@@ -2641,6 +2641,49 @@
|
||||
PlayerNotesPage(text2num(href_list["index"]))
|
||||
return
|
||||
|
||||
else if(href_list["warnsearchckey"] || href_list["warnsearchadmin"])
|
||||
var/adminckey = href_list["warnsearchadmin"]
|
||||
var/playerckey = href_list["warnsearchckey"]
|
||||
|
||||
warning_panel(adminckey, playerckey)
|
||||
return
|
||||
|
||||
else if(href_list["dbwarningedit"])
|
||||
var/warningEdit = href_list["dbwarningedit"]
|
||||
var/warningId = text2num(href_list["dbwarningid"])
|
||||
if(!warningEdit || !warningId)
|
||||
return
|
||||
|
||||
warningsEdit(warningId, warningEdit)
|
||||
return
|
||||
|
||||
else if(href_list["dbnoteedit"])
|
||||
var/noteedit = href_list["dbnoteedit"]
|
||||
var/noteid = text2num(href_list["dbnoteid"])
|
||||
if(!noteedit || !noteid)
|
||||
return
|
||||
|
||||
notes_edit_sql(noteid, noteedit)
|
||||
return
|
||||
|
||||
else if(href_list["notessearchckey"] || href_list["notessearchadmin"])
|
||||
var/adminckey = href_list["notessearchadmin"]
|
||||
var/playerckey = href_list["notessearchckey"]
|
||||
|
||||
show_notes_sql(playerckey, adminckey)
|
||||
return
|
||||
|
||||
else if(href_list["admin_wind_player"])
|
||||
|
||||
var/mob/M = locate(href_list["admin_wind_player"])
|
||||
if(!ismob(M))
|
||||
usr << "This can only be used on instances of type /mob"
|
||||
return
|
||||
|
||||
paralyze_mob(M)
|
||||
|
||||
return
|
||||
|
||||
mob/living/proc/can_centcom_reply()
|
||||
return 0
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ var/inactive_keys = "None<br>"
|
||||
//run a query to get all ckeys inactive for over 2 months
|
||||
var/list/inactive_ckeys = list()
|
||||
if(ckeys_with_customitems.len)
|
||||
var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey, lastseen FROM erro_player WHERE datediff(Now(), lastseen) > 60")
|
||||
var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey, lastseen FROM ss13_player WHERE datediff(Now(), lastseen) > 60")
|
||||
query_inactive.Execute()
|
||||
while(query_inactive.NextRow())
|
||||
var/cur_ckey = query_inactive.item[1]
|
||||
@@ -67,7 +67,7 @@ var/inactive_keys = "None<br>"
|
||||
//if there are ckeys left over, check whether they have a database entry at all
|
||||
if(ckeys_with_customitems.len)
|
||||
for(var/cur_ckey in ckeys_with_customitems)
|
||||
var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE ckey = '[cur_ckey]'")
|
||||
var/DBQuery/query_inactive = dbcon.NewQuery("SELECT ckey FROM ss13_player WHERE ckey = '[cur_ckey]'")
|
||||
query_inactive.Execute()
|
||||
if(!query_inactive.RowCount())
|
||||
inactive_ckeys += cur_ckey
|
||||
|
||||
@@ -0,0 +1,412 @@
|
||||
/*
|
||||
* DB based warning proc
|
||||
*/
|
||||
|
||||
/client/proc/warn(warned_ckey)
|
||||
if (!check_rights(R_ADMIN|R_MOD))
|
||||
return
|
||||
|
||||
if (!warned_ckey || !istext(warned_ckey))
|
||||
return
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
usr << "<font color='red'>Error: warn(): Database Connection failed, reverting to legacy systems.</font>"
|
||||
usr.client.warn_legacy(warned_ckey)
|
||||
return
|
||||
|
||||
var/warning_reason = input("Add Warning Reason. This is visible to the player.") as null|text
|
||||
|
||||
if (!warning_reason)
|
||||
return
|
||||
|
||||
var/warning_notes = input("Add additional informatoin. This is visible only to staff.") as null|text
|
||||
|
||||
var/warning_severity
|
||||
switch (alert("Set warning severity", null, "Standard", "Severe"))
|
||||
if ("standard")
|
||||
warning_severity = 0
|
||||
if ("Severe")
|
||||
warning_severity = 1
|
||||
|
||||
var/warned_computerid = null
|
||||
var/warned_ip = null
|
||||
var/client/C = directory[warned_ckey]
|
||||
if (C)
|
||||
warned_computerid = C.computer_id
|
||||
warned_ip = C.address
|
||||
else
|
||||
var/DBQuery/lookup_query = dbcon.NewQuery("SELECT ip, computerid FROM ss13_player WHERE ckey = :ckey")
|
||||
lookup_query.Execute(list(":ckey" = warned_ckey))
|
||||
|
||||
if (lookup_query.NextRow())
|
||||
warned_ip = lookup_query.item[1]
|
||||
warned_computerid = lookup_query.item[2]
|
||||
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_warnings (id, time, severity, reason, notes, ckey, computerid, ip, a_ckey, a_ip, a_computerid) VALUES (null, Now(), :warning_severity, :warning_reason, :warning_notes, :warned_ckey, :warned_computerid, :warned_ip, :a_ckey, :a_ip, :a_computerid)")
|
||||
insert_query.Execute(list(":warning_severity" = warning_severity, ":warning_reason" = warning_reason, ":warning_notes" = warning_notes, ":warned_ckey" = warned_ckey, ":warned_computerid" = warned_computerid, ":warned_ip" = warned_ip, ":a_ckey" = ckey, ":a_ip" = address, ":a_computerid" = computer_id))
|
||||
|
||||
notes_add_sql(warned_ckey, "Warning added by [ckey], for: [warning_reason]. || Notes regarding the warning: [warning_notes].", src, warned_ip, warned_computerid)
|
||||
|
||||
feedback_add_details("admin_verb", "WARN-DB")
|
||||
if (C)
|
||||
C << "<font color='red'><BIG><B>You have been warned by an administrator.</B></BIG><br>Click <a href='byond://?src=\ref[src];warnview=1'>here</a> to review and acknowledge them!</font>"
|
||||
|
||||
message_admins("[key_name_admin(src)] has warned [warned_ckey] for: [warning_reason].")
|
||||
|
||||
/*
|
||||
* Legacy warning proc
|
||||
*/
|
||||
|
||||
#define MAX_WARNS 3
|
||||
#define AUTOBANTIME 10
|
||||
|
||||
/client/proc/warn_legacy(warned_ckey)
|
||||
if (!warned_ckey)
|
||||
usr << "<font color='red'>Error: warn_legacy(): No ckey passed!</font>"
|
||||
return
|
||||
|
||||
var/datum/preferences/D
|
||||
var/client/C = directory[warned_ckey]
|
||||
if(C) D = C.prefs
|
||||
else D = preferences_datums[warned_ckey]
|
||||
|
||||
if(!D)
|
||||
src << "<font color='red'>Error: warn_legacy(): No such ckey found.</font>"
|
||||
return
|
||||
|
||||
if(++D.warns >= MAX_WARNS) //uh ohhhh...you'reee iiiiin trouuuubble O:)
|
||||
ban_unban_log_save("[ckey] warned [warned_ckey], resulting in a [AUTOBANTIME] minute autoban.")
|
||||
if(C)
|
||||
message_admins("[key_name_admin(src)] has warned [key_name_admin(C)] resulting in a [AUTOBANTIME] minute ban.")
|
||||
C << "<font color='red'><BIG><B>You have been autobanned due to a warning by [ckey].</B></BIG><br>This is a temporary ban, it will be removed in [AUTOBANTIME] minutes."
|
||||
qdel(C)
|
||||
else
|
||||
message_admins("[key_name_admin(src)] has warned [warned_ckey] resulting in a [AUTOBANTIME] minute ban.")
|
||||
AddBan(warned_ckey, D.last_id, "Autobanning due to too many formal warnings", ckey, 1, AUTOBANTIME)
|
||||
feedback_inc("ban_warn",1)
|
||||
else
|
||||
if(C)
|
||||
C << "<font color='red'><BIG><B>You have been warned by an administrator.</B></BIG><br>Further warnings will result in an autoban.</font>"
|
||||
message_admins("[key_name_admin(src)] has warned [key_name_admin(C)]. They have [MAX_WARNS-D.warns] strikes remaining.")
|
||||
else
|
||||
message_admins("[key_name_admin(src)] has warned [warned_ckey] (DC). They have [MAX_WARNS-D.warns] strikes remaining.")
|
||||
|
||||
feedback_add_details("admin_verb","WARN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
#undef MAX_WARNS
|
||||
#undef AUTOBANTIME
|
||||
|
||||
/*
|
||||
* A proc for a player to check their own warnings
|
||||
*/
|
||||
|
||||
/client/verb/warnings_check()
|
||||
set name = "My warnings"
|
||||
set category = "OOC"
|
||||
set desc = "Display warnings issued to you."
|
||||
|
||||
var/lcolor = "#ffeeee" //light colour, severity = 0
|
||||
var/dcolor = "#ffaaaa" //dark colour, severity = 1
|
||||
var/ecolor = "#e3e3e3" //gray colour, expired = 1
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
alert("Connection to the SQL database lost. Aborting. Please alert an Administrator or a member of staff.")
|
||||
return
|
||||
|
||||
var/dat = "<div align='center'><h3>Warnings received</h3></div><br>"
|
||||
|
||||
dat += "<table width='90%' bgcolor='#e3e3e3' cellpadding='5' cellspacing='0' align='center'>"
|
||||
dat += "<tr>"
|
||||
dat += "<th width='20%'>ADMIN</th>"
|
||||
dat += "<th width='20%'>TIME ISSUED</th>"
|
||||
dat += "<th width='60%'>REASON</th>"
|
||||
dat += "</tr>"
|
||||
|
||||
var/DBQuery/search_query = dbcon.NewQuery("SELECT id, time, severity, reason, a_ckey, acknowledged, expired FROM ss13_warnings WHERE visible = 1 AND (ckey = :ckey OR computerid = :computer_id OR ip = :address) ORDER BY time DESC;")
|
||||
search_query.Execute(list(":ckey" = ckey, ":computer_id" = computer_id, ":address" = address))
|
||||
|
||||
while (search_query.NextRow())
|
||||
var/id = text2num(search_query.item[1])
|
||||
var/time = search_query.item[2]
|
||||
var/severity = text2num(search_query.item[3])
|
||||
var/reason = search_query.item[4]
|
||||
var/a_ckey = search_query.item[5]
|
||||
var/ackn = text2num(search_query.item[6])
|
||||
var/expired = text2num(search_query.item[7])
|
||||
|
||||
var/bgcolor = lcolor
|
||||
|
||||
if (severity)
|
||||
bgcolor = dcolor
|
||||
|
||||
if (expired)
|
||||
bgcolor = ecolor
|
||||
|
||||
dat += "<tr bgcolor='[bgcolor]' align='center'>"
|
||||
dat += "<td>[a_ckey]</td>"
|
||||
dat += "<td>[time]</td>"
|
||||
dat += "<td>[reason]</td>"
|
||||
dat += "</tr>"
|
||||
|
||||
if (!ackn)
|
||||
dat += "<tr><td align='center' colspan='3'><b>(<a href='byond://?src=\ref[src];warnacknowledge=[id]'>Acknowledge Warning</a>)</b></td></tr>"
|
||||
else if (expired)
|
||||
dat += "<tr><td align='center' colspan='3'><b>Warning expired and no longer active!</b></td></tr>"
|
||||
else
|
||||
dat += "<tr><td align='center' colspan='3'><b>Warning acknowledged!</b></td></tr>"
|
||||
|
||||
dat += "<tr>"
|
||||
dat += "<td colspan='5' bgcolor='white'> </td>"
|
||||
dat += "</tr>"
|
||||
|
||||
dat += "</table>"
|
||||
usr << browse(dat, "window=mywarnings;size=900x500")
|
||||
|
||||
/*
|
||||
* A proc for acknowledging a warning
|
||||
*/
|
||||
|
||||
/client/proc/warnings_acknowledge(warning_id)
|
||||
if (!warning_id)
|
||||
return
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
alert("Connection to SQL database failed while attempting to update your warning's status!")
|
||||
return
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("UPDATE ss13_warnings SET acknowledged = 1 WHERE id = :warning_id;")
|
||||
query.Execute(list(":warning_id" = warning_id))
|
||||
|
||||
warnings_check()
|
||||
|
||||
/*
|
||||
* A proc to alert you if you have unacknowledged warnings.
|
||||
* Called in /client/New (client procs.dm)
|
||||
*/
|
||||
|
||||
/client/proc/warnings_alert()
|
||||
var/count = 0
|
||||
var/count_expire = 0
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
return
|
||||
|
||||
var/list/client_details = list(":ckey" = ckey, ":computer_id" = computer_id, ":address" = address)
|
||||
|
||||
var/DBQuery/expire_query = dbcon.NewQuery("SELECT id FROM ss13_warnings WHERE (acknowledged = 1 AND expired = 0 AND DATE_SUB(CURDATE(),INTERVAL 3 MONTH) > time) AND (ckey = :ckey OR computerid = :computer_id OR ip = :address)")
|
||||
expire_query.Execute(client_details)
|
||||
while (expire_query.NextRow())
|
||||
var/warning_id = text2num(expire_query.item[1])
|
||||
var/DBQuery/update_query = dbcon.NewQuery("UPDATE ss13_warnings SET expired = 1 WHERE id = :warning_id")
|
||||
update_query.Execute(list(":warning_id" = warning_id))
|
||||
count_expire++
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM ss13_warnings WHERE (visible = 1 AND acknowledged = 0 AND expired = 0) AND (ckey = :ckey OR computerid = :computer_id OR ip = :address)")
|
||||
query.Execute(client_details)
|
||||
while (query.NextRow())
|
||||
count++
|
||||
|
||||
if (count)
|
||||
src << "<br>"
|
||||
src << "<font color=red><b>You have [count] unread [count > 1 ? "warnings" : "warning"]! Click <a href='byond://?src=\ref[src];warnview=1'>here</a> to review and acknowledge them!</b></font>"
|
||||
if (count_expire)
|
||||
src << "<br>"
|
||||
src << "<font color=blue><b>[count_expire] of your warnings expired.</b></font>"
|
||||
|
||||
/*
|
||||
* A proc for an admin/moderator to look up a member's warnings.
|
||||
*/
|
||||
|
||||
/client/proc/warning_panel()
|
||||
set category = "Admin"
|
||||
set name = "Warnings Panel"
|
||||
set desc = "Look-up warnings assigned to players."
|
||||
|
||||
if(!holder)
|
||||
return
|
||||
|
||||
holder.warning_panel()
|
||||
|
||||
/datum/admins/proc/warning_panel(var/adminckey = null, var/playerckey = null)
|
||||
if (!check_rights(R_ADMIN|R_MOD))
|
||||
return
|
||||
|
||||
var/lcolor = "#ffeeee" //light colour, severity = 0
|
||||
var/dcolor = "#ffdddd" //dark colour, severity = 1
|
||||
var/ecolor = "#e3e3e3" //gray colour, expired = 1
|
||||
|
||||
establish_db_connection()
|
||||
if (!dbcon.IsConnected())
|
||||
alert("Connection to the SQL database lost. Aborting. Please alert the database admin!")
|
||||
return
|
||||
|
||||
var/dat = "<div align='center'><h3>Warning Look-up Panel</h3><br>"
|
||||
|
||||
//Totally not stealing code from the DB_ban_panel
|
||||
|
||||
dat += "<form method='GET' action='?src=\ref[src]'><b>Search:</b> "
|
||||
dat += "<input type='hidden' name='src' value='\ref[src]'>"
|
||||
dat += "<b>Ckey:</b> <input type='text' name='warnsearchckey' value='[playerckey]'>"
|
||||
dat += "<b>Admin ckey:</b> <input type='text' name='warnsearchadmin' value='[adminckey]'>"
|
||||
dat += "<input type='submit' value='search'>"
|
||||
dat += "</form></div>"
|
||||
|
||||
if (adminckey || playerckey)
|
||||
|
||||
dat += "<table width='90%' bgcolor='#e3e3e3' cellpadding='5' cellspacing='0' align='center'>"
|
||||
dat += "<tr>"
|
||||
dat += "<th width='10%'>ISSUED TO</th>"
|
||||
dat += "<th width='10%'>ISSUED BY</th>"
|
||||
dat += "<th width='10%'>TIME ISSUED</th>"
|
||||
dat += "<th width='60%'>REASON</th>"
|
||||
dat += "</tr>"
|
||||
|
||||
var/list/query_details = list("a_ckey", "ckey")
|
||||
var/paramone = ""
|
||||
var/paramtwo = ""
|
||||
if(adminckey)
|
||||
paramone = "AND a_ckey = :a_ckey "
|
||||
query_details["a_ckey"] = adminckey
|
||||
if(playerckey)
|
||||
paramtwo = "AND ckey = :ckey "
|
||||
query_details["ckey"] = playerckey
|
||||
|
||||
var/DBQuery/search_query = dbcon.NewQuery("SELECT id, time, severity, reason, notes, ckey, a_ckey, acknowledged, expired, edited, lasteditor, lasteditdate FROM ss13_warnings WHERE visible = 1 [paramone] [paramtwo] ORDER BY time DESC;")
|
||||
search_query.Execute(query_details, 1)
|
||||
|
||||
while (search_query.NextRow())
|
||||
var/id = text2num(search_query.item[1])
|
||||
var/time = search_query.item[2]
|
||||
var/severity = text2num(search_query.item[3])
|
||||
var/reason = search_query.item[4]
|
||||
var/notes = search_query.item[5]
|
||||
var/ckey = search_query.item[6]
|
||||
var/a_ckey = search_query.item[7]
|
||||
var/ackn = text2num(search_query.item[8])
|
||||
var/expired = text2num(search_query.item[9])
|
||||
var/edited = text2num(search_query.item[10])
|
||||
|
||||
var/bgcolor = lcolor
|
||||
|
||||
if(severity)
|
||||
bgcolor = dcolor
|
||||
if(expired)
|
||||
bgcolor = ecolor
|
||||
|
||||
dat += "<tr bgcolor='[bgcolor]' align='center'>"
|
||||
dat += "<td>[ckey]</td>"
|
||||
dat += "<td>[a_ckey]</td>"
|
||||
dat += "<td>[time]</td>"
|
||||
dat += "<td>[reason]</td>"
|
||||
dat += "</tr>"
|
||||
dat += "<tr>"
|
||||
dat += "<td align='center' colspan='5'><b>Staff Notes:</b> <cite>\"[notes]\"</cite></td>"
|
||||
dat += "</tr>"
|
||||
if(!ackn)
|
||||
dat += "<tr><td align='center' colspan='5'>Warning has not been acknolwedged by recipient.</td></tr>"
|
||||
if(expired)
|
||||
dat += "<tr><td align='center' colspan='5'>The warning has expired.</td></tr>"
|
||||
if(edited)
|
||||
var/lastEditor = search_query.item[11]
|
||||
var/lastEditDate = search_query.item[12]
|
||||
dat += "<tr><td align='center' colspan='5'><b>Warning last edited: [lastEditDate], by: [lastEditor].</b></td></tr>"
|
||||
dat += "<tr>"
|
||||
dat += "<td align='center' colspan='5'><b>Options:</b> "
|
||||
if(check_rights(R_ADMIN) || a_ckey == sanitizeSQL(ckey))
|
||||
dat += "<a href=\"byond://?src=\ref[src];dbwarningedit=editReason;dbwarningid=[id]\">Edit Reason</a> "
|
||||
dat += "<a href=\"byond://?src=\ref[src];dbwarningedit=editNotes;dbwarningid=[id]\">Edit Note</a> "
|
||||
dat += "<a href=\"byond://?src=\ref[src];dbwarningedit=delete;dbwarningid=[id]\">Delete Warning</a>"
|
||||
else
|
||||
dat += "You can only edit or delete notes that you have issued."
|
||||
dat += "</td>"
|
||||
dat += "</tr>"
|
||||
|
||||
dat += "<tr>"
|
||||
dat += "<td colspan='5' bgcolor='white'> </td>"
|
||||
dat += "</tr>"
|
||||
|
||||
dat +="</table>"
|
||||
|
||||
usr << browse(dat, "window=lookupwarns;size=900x500")
|
||||
feedback_add_details("admin_verb","WARN-LKUP")
|
||||
|
||||
/*
|
||||
* A proc for editing and deleting warnings issued
|
||||
*/
|
||||
|
||||
/proc/warningsEdit(var/warning_id, var/warning_edit)
|
||||
if(!warning_id || !warning_edit)
|
||||
return
|
||||
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
alert("Connection to the SQL database lost. Aborting. Please alert the database admin!")
|
||||
return
|
||||
|
||||
var/count = 0 //failsafe
|
||||
var/ckey
|
||||
var/reason
|
||||
var/notes
|
||||
var/list/query_details = list(":warning_id" = warning_id, ":a_ckey" = usr.ckey)
|
||||
|
||||
var/DBQuery/initial_query = dbcon.NewQuery("SELECT ckey, reason, notes FROM ss13_warnings WHERE id = :warning_id")
|
||||
initial_query.Execute(query_details, 1)
|
||||
while (initial_query.NextRow())
|
||||
ckey = initial_query.item[1]
|
||||
reason = initial_query.item[2]
|
||||
notes = initial_query.item[3]
|
||||
count++
|
||||
|
||||
if (count == 0)
|
||||
usr << "\red Database update failed due to a warning id not being present in the database."
|
||||
error("Database update failed due to a warning id not being present in the database.")
|
||||
return
|
||||
|
||||
if (count > 1)
|
||||
usr << "\red Database update failed due to multiple warnings having the same ID. Contact the database admin."
|
||||
error("Database update failed due to multiple warnings having the same ID. Contact the database admin.")
|
||||
return
|
||||
|
||||
switch (warning_edit)
|
||||
if ("delete")
|
||||
if(alert("Delete this warning?", "Delete?", "Yes", "No") == "Yes")
|
||||
var/DBQuery/deleteQuery = dbcon.NewQuery("UPDATE ss13_warnings SET visible = 0 WHERE id = :warning_id")
|
||||
deleteQuery.Execute(query_details)
|
||||
|
||||
message_admins("\blue [key_name_admin(usr)] deleted one of [ckey]'s warnings.")
|
||||
log_admin("[key_name(usr)] deleted one of [ckey]'s warnings.")
|
||||
else
|
||||
usr << "Cancelled"
|
||||
return
|
||||
|
||||
if ("editReason")
|
||||
query_details += ":new_reason"
|
||||
query_details[":new_reason"] = input("Edit this warning's reason.", "New Reason", reason, null) as null|text
|
||||
|
||||
if(!query_details[":new_reason"] || query_details[":new_reason"] == reason)
|
||||
usr << "Cancelled"
|
||||
return
|
||||
|
||||
var/DBQuery/reason_query = dbcon.NewQuery("UPDATE ss13_warnings SET reason = :new_reason, edited = 1, lasteditor = :a_ckey, lasteditdate = NOW() WHERE id = :warning_id")
|
||||
reason_query.Execute(query_details, 1)
|
||||
|
||||
message_admins("\blue [key_name_admin(usr)] edited one of [ckey]'s warning reasons.")
|
||||
log_admin("[key_name(usr)] edited one of [ckey]'s warning reasons.")
|
||||
|
||||
if("editNotes")
|
||||
query_details += ":new_notes"
|
||||
query_details[":new_notes"] = input("Edit this warning's notes.", "New Notes", notes, null) as null|text
|
||||
|
||||
if(!query_details[":new_notes"] || query_details[":new_notes"] == notes)
|
||||
usr << "Cancelled"
|
||||
return
|
||||
|
||||
var/DBQuery/notes_query = dbcon.NewQuery("UPDATE ss13_warnings SET notes = :new_notes, edited = 1, lasteditor = :a_ckey, lasteditdate = NOW() WHERE id = :warning_id")
|
||||
notes_query.Execute(query_details, 1)
|
||||
|
||||
message_admins("\blue [key_name_admin(usr)] edited one of [ckey]'s warning notes.")
|
||||
log_admin("[key_name(usr)] edited one of [ckey]'s warning notes.")
|
||||
@@ -45,5 +45,6 @@
|
||||
var/player_age = "Requires database" //So admins know why it isn't working - Used to determine how old the account is - in days.
|
||||
var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip
|
||||
var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id
|
||||
var/whitelist_status = 0 //Used to determine what whitelists the player has access to. Uses bitflag values!
|
||||
|
||||
preload_rsc = 0 // This is 0 so we can set it to an URL once the player logs in and have them download the resources from a different server.
|
||||
|
||||
@@ -164,6 +164,8 @@
|
||||
sleep(2) // wait a bit more, possibly fixes hardware mode not re-activating right
|
||||
winset(src, null, "command=\".configure graphics-hwmode on\"")
|
||||
|
||||
warnings_alert()
|
||||
|
||||
log_client_to_db()
|
||||
|
||||
send_resources()
|
||||
@@ -200,7 +202,7 @@
|
||||
|
||||
var/sql_ckey = sql_sanitize_text(ckey(key))
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT datediff(Now(),firstseen) as age FROM ss13_player WHERE ckey = '[sql_ckey]'")
|
||||
query.Execute()
|
||||
|
||||
if(query.NextRow())
|
||||
@@ -220,23 +222,24 @@
|
||||
|
||||
var/sql_ckey = sql_sanitize_text(src.ckey)
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age, whitelist_status FROM ss13_player WHERE ckey = '[sql_ckey]'")
|
||||
query.Execute()
|
||||
var/sql_id = 0
|
||||
player_age = 0 // New players won't have an entry so knowing we have a connection we set this to zero to be updated if their is a record.
|
||||
while(query.NextRow())
|
||||
sql_id = query.item[1]
|
||||
player_age = text2num(query.item[2])
|
||||
whitelist_status = text2num(query.item[3])
|
||||
break
|
||||
|
||||
var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE ip = '[address]'")
|
||||
var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM ss13_player WHERE ip = '[address]'")
|
||||
query_ip.Execute()
|
||||
related_accounts_ip = ""
|
||||
while(query_ip.NextRow())
|
||||
related_accounts_ip += "[query_ip.item[1]], "
|
||||
break
|
||||
|
||||
var/DBQuery/query_cid = dbcon.NewQuery("SELECT ckey FROM erro_player WHERE computerid = '[computer_id]'")
|
||||
var/DBQuery/query_cid = dbcon.NewQuery("SELECT ckey FROM ss13_player WHERE computerid = '[computer_id]'")
|
||||
query_cid.Execute()
|
||||
related_accounts_cid = ""
|
||||
while(query_cid.NextRow())
|
||||
@@ -261,16 +264,16 @@
|
||||
|
||||
if(sql_id)
|
||||
//Player already identified previously, we need to just update the 'lastseen', 'ip' and 'computer_id' variables
|
||||
var/DBQuery/query_update = dbcon.NewQuery("UPDATE erro_player SET lastseen = Now(), ip = '[sql_ip]', computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]' WHERE id = [sql_id]")
|
||||
var/DBQuery/query_update = dbcon.NewQuery("UPDATE ss13_player SET lastseen = Now(), ip = '[sql_ip]', computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]' WHERE id = [sql_id]")
|
||||
query_update.Execute()
|
||||
else
|
||||
//New player!! Need to insert all the stuff
|
||||
var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO erro_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')")
|
||||
var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO ss13_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')")
|
||||
query_insert.Execute()
|
||||
|
||||
//Logging player access
|
||||
var/serverip = "[world.internet_address]:[world.port]"
|
||||
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `erro_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');")
|
||||
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `ss13_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');")
|
||||
query_accesslog.Execute()
|
||||
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>
|
||||
<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"}
|
||||
if(1)
|
||||
establish_old_db_connection()
|
||||
if(!dbcon_old.IsConnected())
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font><BR>"
|
||||
else if(!SQLquery)
|
||||
dat += "<font color=red><b>ERROR</b>: Malformed search request. Please contact your system administrator for assistance.</font><BR>"
|
||||
@@ -52,7 +52,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
dat += {"<table>
|
||||
<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td>SS<sup>13</sup>BN</td></tr>"}
|
||||
|
||||
var/DBQuery/query = dbcon_old.NewQuery(SQLquery)
|
||||
var/DBQuery/query = dbcon.NewQuery(SQLquery)
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
@@ -189,15 +189,15 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"}
|
||||
if(4)
|
||||
dat += "<h3>External Archive</h3>"
|
||||
establish_old_db_connection()
|
||||
if(!dbcon_old.IsConnected())
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
|
||||
else
|
||||
dat += {"<A href='?src=\ref[src];orderbyid=1'>(Order book by SS<sup>13</sup>BN)</A><BR><BR>
|
||||
<table>
|
||||
<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td></td></tr>"}
|
||||
|
||||
var/DBQuery/query = dbcon_old.NewQuery("SELECT id, author, title, category FROM library")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id, author, title, category FROM ss13_library")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
@@ -332,8 +332,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
if(scanner.cache.unique)
|
||||
alert("This book has been rejected from the database. Aborting!")
|
||||
else
|
||||
establish_old_db_connection()
|
||||
if(!dbcon_old.IsConnected())
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
alert("Connection to Archive has been severed. Aborting.")
|
||||
else
|
||||
/*
|
||||
@@ -346,7 +346,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
var/sqlauthor = sanitizeSQL(scanner.cache.author)
|
||||
var/sqlcontent = sanitizeSQL(scanner.cache.dat)
|
||||
var/sqlcategory = sanitizeSQL(upload_category)
|
||||
var/DBQuery/query = dbcon_old.NewQuery("INSERT INTO library (author, title, content, category) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]')")
|
||||
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_library (author, title, content, category) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]')")
|
||||
if(!query.Execute())
|
||||
usr << query.ErrorMsg()
|
||||
else
|
||||
@@ -355,8 +355,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
|
||||
if(href_list["targetid"])
|
||||
var/sqlid = sanitizeSQL(href_list["targetid"])
|
||||
establish_old_db_connection()
|
||||
if(!dbcon_old.IsConnected())
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
alert("Connection to Archive has been severed. Aborting.")
|
||||
if(bibledelay)
|
||||
for (var/mob/V in hearers(src))
|
||||
@@ -365,7 +365,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
|
||||
bibledelay = 1
|
||||
spawn(60)
|
||||
bibledelay = 0
|
||||
var/DBQuery/query = dbcon_old.NewQuery("SELECT * FROM library WHERE id=[sqlid]")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM ss13_library WHERE id=[sqlid]")
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
|
||||
@@ -1073,3 +1073,39 @@ mob/proc/yank_out_object()
|
||||
src.in_throw_mode = 1
|
||||
if(src.throw_icon)
|
||||
src.throw_icon.icon_state = "act_throw_on"
|
||||
|
||||
//Admin helpers
|
||||
/mob/proc/wind_mob(var/mob/admin)
|
||||
if (!admin)
|
||||
return
|
||||
|
||||
if (!check_rights((R_MOD|R_ADMIN), 1, admin))
|
||||
return
|
||||
|
||||
if (alert(admin, "Wind [src]?",,"Yes","No")!="Yes")
|
||||
return
|
||||
|
||||
SetWeakened(200)
|
||||
visible_message("<font color='#002eb8'><b>OOC Information:</b></font> <font color='red'>[src] has been winded by a member of staff! Please freeze all roleplay involving their character until the matter is resolved! Adminmhelp if you have further questions.</font>", "<font color='red'><b>You have been winded by a member of staff! Please stand by until they contact you!</b></font>")
|
||||
log_admin("[key_name(admin)] winded [key_name(src)]!")
|
||||
message_admins("[key_name_admin(admin)] winded [key_name_admin(src)]!", 1)
|
||||
|
||||
feedback_add_details("admin_verb", "WIND")
|
||||
|
||||
return
|
||||
|
||||
/mob/proc/unwind_mob(var/mob/admin)
|
||||
if (!admin)
|
||||
return
|
||||
|
||||
if (!check_rights((R_MOD|R_ADMIN), 1, admin))
|
||||
return
|
||||
|
||||
SetWeakened(0)
|
||||
visible_message("<font color='#002eb8'><b>OOC Information:</b></font> <font color='green'>[src] has been unwinded by a member of staff!</font>", "<font color='red'><b>You have been unwinded by a member of staff!</b></font>")
|
||||
log_admin("[key_name(admin)] unwinded [key_name(src)]!")
|
||||
message_admins("[key_name_admin(admin)] unwinded [key_name_admin(src)]!", 1)
|
||||
|
||||
feedback_add_details("admin_verb", "UNWIND")
|
||||
|
||||
return
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
var/isadmin = 0
|
||||
if(src.client && src.client.holder)
|
||||
isadmin = 1
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM erro_poll_textreply WHERE ckey = \"[ckey]\")")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM ss13_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM ss13_poll_vote WHERE ckey = \"[ckey]\") AND id NOT IN (SELECT pollid FROM ss13_poll_textreply WHERE ckey = \"[ckey]\")")
|
||||
query.Execute()
|
||||
var/newpoll = 0
|
||||
while(query.NextRow())
|
||||
@@ -187,7 +187,7 @@
|
||||
var/voted = 0
|
||||
|
||||
//First check if the person has not voted yet.
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM erro_privacy WHERE ckey='[src.ckey]'")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM ss13_privacy WHERE ckey='[src.ckey]'")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
voted = 1
|
||||
@@ -212,7 +212,7 @@
|
||||
return
|
||||
|
||||
if(!voted)
|
||||
var/sql = "INSERT INTO erro_privacy VALUES (null, Now(), '[src.ckey]', '[option]')"
|
||||
var/sql = "INSERT INTO ss13_privacy VALUES (null, Now(), '[src.ckey]', '[option]')"
|
||||
var/DBQuery/query_insert = dbcon.NewQuery(sql)
|
||||
query_insert.Execute()
|
||||
usr << "<b>Thank you for your vote!</b>"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
return
|
||||
var/voted = 0
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM erro_privacy WHERE ckey='[src.ckey]'")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM ss13_privacy WHERE ckey='[src.ckey]'")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
voted = 1
|
||||
@@ -53,7 +53,7 @@
|
||||
if(src.client && src.client.holder)
|
||||
isadmin = 1
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, question FROM erro_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, question FROM ss13_poll_question WHERE [(isadmin ? "" : "adminonly = false AND")] Now() BETWEEN starttime AND endtime")
|
||||
select_query.Execute()
|
||||
|
||||
var/output = "<div align='center'><B>Player polls</B>"
|
||||
@@ -84,7 +84,7 @@
|
||||
establish_db_connection()
|
||||
if(dbcon.IsConnected())
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM erro_poll_question WHERE id = [pollid]")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM ss13_poll_question WHERE id = [pollid]")
|
||||
select_query.Execute()
|
||||
|
||||
var/pollstarttime = ""
|
||||
@@ -109,7 +109,7 @@
|
||||
switch(polltype)
|
||||
//Polls that have enumerated options
|
||||
if("OPTION")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM erro_poll_vote WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM ss13_poll_vote WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
voted_query.Execute()
|
||||
|
||||
var/voted = 0
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
var/list/datum/polloption/options = list()
|
||||
|
||||
var/DBQuery/options_query = dbcon.NewQuery("SELECT id, text FROM erro_poll_option WHERE pollid = [pollid]")
|
||||
var/DBQuery/options_query = dbcon.NewQuery("SELECT id, text FROM ss13_poll_option WHERE pollid = [pollid]")
|
||||
options_query.Execute()
|
||||
while(options_query.NextRow())
|
||||
var/datum/polloption/PO = new()
|
||||
@@ -162,7 +162,7 @@
|
||||
|
||||
//Polls with a text input
|
||||
if("TEXT")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT replytext FROM erro_poll_textreply WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT replytext FROM ss13_poll_textreply WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
voted_query.Execute()
|
||||
|
||||
var/voted = 0
|
||||
@@ -204,7 +204,7 @@
|
||||
|
||||
//Polls with a text input
|
||||
if("NUMVAL")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT o.text, v.rating FROM erro_poll_option o, erro_poll_vote v WHERE o.pollid = [pollid] AND v.ckey = '[usr.ckey]' AND o.id = v.optionid")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT o.text, v.rating FROM ss13_poll_option o, ss13_poll_vote v WHERE o.pollid = [pollid] AND v.ckey = '[usr.ckey]' AND o.id = v.optionid")
|
||||
voted_query.Execute()
|
||||
|
||||
var/output = "<div align='center'><B>Player poll</B>"
|
||||
@@ -230,7 +230,7 @@
|
||||
var/minid = 999999
|
||||
var/maxid = 0
|
||||
|
||||
var/DBQuery/option_query = dbcon.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM erro_poll_option WHERE pollid = [pollid]")
|
||||
var/DBQuery/option_query = dbcon.NewQuery("SELECT id, text, minval, maxval, descmin, descmid, descmax FROM ss13_poll_option WHERE pollid = [pollid]")
|
||||
option_query.Execute()
|
||||
while(option_query.NextRow())
|
||||
var/optionid = text2num(option_query.item[1])
|
||||
@@ -273,7 +273,7 @@
|
||||
|
||||
src << browse(output,"window=playerpoll;size=500x500")
|
||||
if("MULTICHOICE")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM erro_poll_vote WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT optionid FROM ss13_poll_vote WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
voted_query.Execute()
|
||||
|
||||
var/list/votedfor = list()
|
||||
@@ -286,7 +286,7 @@
|
||||
var/maxoptionid = 0
|
||||
var/minoptionid = 0
|
||||
|
||||
var/DBQuery/options_query = dbcon.NewQuery("SELECT id, text FROM erro_poll_option WHERE pollid = [pollid]")
|
||||
var/DBQuery/options_query = dbcon.NewQuery("SELECT id, text FROM ss13_poll_option WHERE pollid = [pollid]")
|
||||
options_query.Execute()
|
||||
while(options_query.NextRow())
|
||||
var/datum/polloption/PO = new()
|
||||
@@ -345,7 +345,7 @@
|
||||
establish_db_connection()
|
||||
if(dbcon.IsConnected())
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM erro_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM ss13_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
|
||||
select_query.Execute()
|
||||
|
||||
var/validpoll = 0
|
||||
@@ -363,7 +363,7 @@
|
||||
usr << "\red Poll is not valid."
|
||||
return
|
||||
|
||||
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM erro_poll_option WHERE id = [optionid] AND pollid = [pollid]")
|
||||
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM ss13_poll_option WHERE id = [optionid] AND pollid = [pollid]")
|
||||
select_query2.Execute()
|
||||
|
||||
var/validoption = 0
|
||||
@@ -378,7 +378,7 @@
|
||||
|
||||
var/alreadyvoted = 0
|
||||
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM erro_poll_vote WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM ss13_poll_vote WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
voted_query.Execute()
|
||||
|
||||
while(voted_query.NextRow())
|
||||
@@ -399,7 +399,7 @@
|
||||
adminrank = usr.client.holder.rank
|
||||
|
||||
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO erro_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]')")
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]')")
|
||||
insert_query.Execute()
|
||||
|
||||
usr << "\blue Vote successful."
|
||||
@@ -415,7 +415,7 @@
|
||||
establish_db_connection()
|
||||
if(dbcon.IsConnected())
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM erro_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM ss13_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
|
||||
select_query.Execute()
|
||||
|
||||
var/validpoll = 0
|
||||
@@ -432,7 +432,7 @@
|
||||
|
||||
var/alreadyvoted = 0
|
||||
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM erro_poll_textreply WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM ss13_poll_textreply WHERE pollid = [pollid] AND ckey = '[usr.ckey]'")
|
||||
voted_query.Execute()
|
||||
|
||||
while(voted_query.NextRow())
|
||||
@@ -457,7 +457,7 @@
|
||||
usr << "The text you entered was blank, contained illegal characters or was too long. Please correct the text and submit again."
|
||||
return
|
||||
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO erro_poll_textreply (id ,datetime ,pollid ,ckey ,ip ,replytext ,adminrank) VALUES (null, Now(), [pollid], '[usr.ckey]', '[usr.client.address]', '[replytext]', '[adminrank]')")
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_poll_textreply (id ,datetime ,pollid ,ckey ,ip ,replytext ,adminrank) VALUES (null, Now(), [pollid], '[usr.ckey]', '[usr.client.address]', '[replytext]', '[adminrank]')")
|
||||
insert_query.Execute()
|
||||
|
||||
usr << "\blue Feedback logging successful."
|
||||
@@ -473,7 +473,7 @@
|
||||
establish_db_connection()
|
||||
if(dbcon.IsConnected())
|
||||
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM erro_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
|
||||
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM ss13_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
|
||||
select_query.Execute()
|
||||
|
||||
var/validpoll = 0
|
||||
@@ -488,7 +488,7 @@
|
||||
usr << "\red Poll is not valid."
|
||||
return
|
||||
|
||||
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM erro_poll_option WHERE id = [optionid] AND pollid = [pollid]")
|
||||
var/DBQuery/select_query2 = dbcon.NewQuery("SELECT id FROM ss13_poll_option WHERE id = [optionid] AND pollid = [pollid]")
|
||||
select_query2.Execute()
|
||||
|
||||
var/validoption = 0
|
||||
@@ -503,7 +503,7 @@
|
||||
|
||||
var/alreadyvoted = 0
|
||||
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM erro_poll_vote WHERE optionid = [optionid] AND ckey = '[usr.ckey]'")
|
||||
var/DBQuery/voted_query = dbcon.NewQuery("SELECT id FROM ss13_poll_vote WHERE optionid = [optionid] AND ckey = '[usr.ckey]'")
|
||||
voted_query.Execute()
|
||||
|
||||
while(voted_query.NextRow())
|
||||
@@ -519,7 +519,7 @@
|
||||
adminrank = usr.client.holder.rank
|
||||
|
||||
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO erro_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]', [(isnull(rating)) ? "null" : rating])")
|
||||
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]', [(isnull(rating)) ? "null" : rating])")
|
||||
insert_query.Execute()
|
||||
|
||||
usr << "\blue Vote successful."
|
||||
|
||||
@@ -301,7 +301,7 @@ var/obj/machinery/blackbox_recorder/blackbox
|
||||
if(!dbcon.IsConnected()) return
|
||||
var/round_id
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM erro_feedback")
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM ss13_feedback")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
round_id = query.item[1]
|
||||
@@ -311,7 +311,7 @@ var/obj/machinery/blackbox_recorder/blackbox
|
||||
round_id++
|
||||
|
||||
for(var/datum/feedback_variable/FV in feedback)
|
||||
var/sql = "INSERT INTO erro_feedback VALUES (null, Now(), [round_id], \"[FV.get_variable()]\", [FV.get_value()], \"[FV.get_details()]\")"
|
||||
var/sql = "INSERT INTO ss13_feedback VALUES (null, Now(), [round_id], \"[FV.get_variable()]\", [FV.get_value()], \"[FV.get_details()]\")"
|
||||
var/DBQuery/query_insert = dbcon.NewQuery(sql)
|
||||
query_insert.Execute()
|
||||
|
||||
|
||||
+3
-46
@@ -533,9 +533,9 @@ proc/setup_database_connection()
|
||||
if(!dbcon)
|
||||
dbcon = new()
|
||||
|
||||
var/user = sqlfdbklogin
|
||||
var/pass = sqlfdbkpass
|
||||
var/db = sqlfdbkdb
|
||||
var/user = sqllogin
|
||||
var/pass = sqlpass
|
||||
var/db = sqldb
|
||||
var/address = sqladdress
|
||||
var/port = sqlport
|
||||
|
||||
@@ -559,47 +559,4 @@ proc/establish_db_connection()
|
||||
else
|
||||
return 1
|
||||
|
||||
|
||||
/hook/startup/proc/connectOldDB()
|
||||
if(!setup_old_database_connection())
|
||||
world.log << "Your server failed to establish a connection with the SQL database."
|
||||
else
|
||||
world.log << "SQL database connection established."
|
||||
return 1
|
||||
|
||||
//These two procs are for the old database, while it's being phased out. See the tgstation.sql file in the SQL folder for more information.
|
||||
proc/setup_old_database_connection()
|
||||
|
||||
if(failed_old_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore.
|
||||
return 0
|
||||
|
||||
if(!dbcon_old)
|
||||
dbcon_old = new()
|
||||
|
||||
var/user = sqllogin
|
||||
var/pass = sqlpass
|
||||
var/db = sqldb
|
||||
var/address = sqladdress
|
||||
var/port = sqlport
|
||||
|
||||
dbcon_old.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
||||
. = dbcon_old.IsConnected()
|
||||
if ( . )
|
||||
failed_old_db_connections = 0 //If this connection succeeded, reset the failed connections counter.
|
||||
else
|
||||
failed_old_db_connections++ //If it failed, increase the failed connections counter.
|
||||
world.log << dbcon.ErrorMsg()
|
||||
|
||||
return .
|
||||
|
||||
//This proc ensures that the connection to the feedback database (global variable dbcon) is established
|
||||
proc/establish_old_db_connection()
|
||||
if(failed_old_db_connections > FAILED_DB_CONNECTION_CUTOFF)
|
||||
return 0
|
||||
|
||||
if(!dbcon_old || !dbcon_old.IsConnected())
|
||||
return setup_old_database_connection()
|
||||
else
|
||||
return 1
|
||||
|
||||
#undef FAILED_DB_CONNECTION_CUTOFF
|
||||
|
||||
@@ -17,10 +17,7 @@ LOGIN mylogin
|
||||
PASSWORD mypassword
|
||||
|
||||
# The following information is for feedback tracking via the blackbox server
|
||||
FEEDBACK_DATABASE test
|
||||
FEEDBACK_LOGIN mylogin
|
||||
FEEDBACK_PASSWORD mypassword
|
||||
|
||||
# Track population and death statistics
|
||||
# Comment this out to disable
|
||||
#ENABLE_STAT_TRACKING
|
||||
#ENABLE_STAT_TRACKING
|
||||
|
||||
Reference in New Issue
Block a user