diff --git a/code/game/verbs/who.dm b/code/game/verbs/who.dm
index 3e3f37b4d9d..ff0d03626f8 100644
--- a/code/game/verbs/who.dm
+++ b/code/game/verbs/who.dm
@@ -1,3 +1,29 @@
+proc/get_all_clients()
+ var/list/client/clients = list()
+
+ for (var/mob/M in world)
+ if (!M.client)
+ continue
+
+ clients += M.client
+
+ return clients
+
+proc/get_all_admin_clients()
+ var/list/client/clients = list()
+
+ for (var/mob/M in world)
+ if (!M.client)
+ continue
+
+ if (!M.client.holder)
+ continue
+
+ clients += M.client
+
+ return clients
+
+
/mob/verb/who()
set name = "Who"
set category = "OOC"
diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm
new file mode 100644
index 00000000000..598d16e8a00
--- /dev/null
+++ b/code/modules/admin/DB ban/functions.dm
@@ -0,0 +1,77 @@
+
+obj/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = -1, var/reason, var/job = "", var/rounds = 0)
+ var/user = sqlfdbklogin
+ var/pass = sqlfdbkpass
+ var/db = sqlfdbkdb
+ var/address = sqladdress
+ var/port = sqlport
+
+ var/DBConnection/dbcon = new()
+
+ dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
+ if(!dbcon.IsConnected())
+ return
+
+ var/serverip = "[world.internet_address]:[world.port]"
+ var/bantype_pass = 0
+ var/bantype_str
+ switch(bantype)
+ if(BANTYPE_PERMA)
+ bantype_str = "PERMABAN"
+ duration = -1
+ bantype_pass = 1
+ if(BANTYPE_TEMP)
+ bantype_str = "TEMPBAN"
+ bantype_pass = 1
+ if(BANTYPE_JOB_PERMA)
+ bantype_str = "JOB_PERMABAN"
+ duration = -1
+ bantype_pass = 1
+ if(BANTYPE_JOB_TEMP)
+ bantype_str = "JOB_TEMPBAN"
+ bantype_pass = 1
+ if( !bantype_pass ) return
+ if( !istext(reason) ) return
+ if( !isnum(duration) ) return
+
+ var/ckey
+ var/computerid
+ var/ip
+
+ if(ismob(banned_mob))
+ ckey = banned_mob.ckey
+ if(banned_mob.client)
+ computerid = banned_mob.client.computer_id
+ ip = banned_mob.client.address
+
+ var/a_ckey
+ var/a_computerid
+ var/a_ip
+
+ if(src.owner && istype(src.owner, /client))
+ a_ckey = src.owner:ckey
+ a_computerid = src.owner:computer_id
+ a_ip = src.owner:address
+
+ var/list/client/clients = get_all_clients()
+ var/who
+ for(var/client/C in clients)
+ if(!who)
+ who = "[C]"
+ else
+ who += ", [C]"
+
+ var/list/client/admin_clients = get_all_admin_clients()
+ var/adminwho
+ for(var/client/C in admin_clients)
+ if(!adminwho)
+ adminwho = "[C]"
+ else
+ adminwho += ", [C]"
+
+ var/sql = "INSERT INTO erro_ban 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)"
+ world << sql
+ var/DBQuery/query_insert = dbcon.NewQuery(sql)
+ query_insert.Execute()
+
+ dbcon.Disconnect()
\ No newline at end of file
diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm
index 7c86e0ac061..36923683e43 100644
--- a/code/modules/admin/admin.dm
+++ b/code/modules/admin/admin.dm
@@ -523,6 +523,7 @@ var/global/BSACooldown = 0
ban_unban_log_save("[key_name(usr)] jobbanned [key_name(M)] from [job]. reason: [reason]")
log_admin("[key_name(usr)] banned [key_name(M)] from [job]")
feedback_inc("ban_job",1)
+ DB_ban_record(BANTYPE_JOB_PERMA, M, -1, reason, job)
feedback_add_details("ban_job","- [job]")
jobban_fullban(M, job, "[reason]; By [usr.ckey] on [time2text(world.realtime)]")
if(!msg) msg = job
@@ -602,6 +603,7 @@ var/global/BSACooldown = 0
M << "\redYou have been banned by [usr.client.ckey].\nReason: [reason]."
M << "\red This is a temporary ban, it will be removed in [mins] minutes."
feedback_inc("ban_tmp",1)
+ DB_ban_record(BANTYPE_TEMP, M, mins, reason)
feedback_inc("ban_tmp_mins",mins)
if(config.banappeals)
M << "\red To try to resolve this matter head to [config.banappeals]"
@@ -627,109 +629,12 @@ var/global/BSACooldown = 0
log_admin("[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis is a permanent ban.")
message_admins("\blue[usr.client.ckey] has banned [M.ckey].\nReason: [reason]\nThis is a permanent ban.")
feedback_inc("ban_perma",1)
+ DB_ban_record(BANTYPE_PERMA, M, -1, reason)
del(M.client)
//del(M)
if("Cancel")
return
- if (href_list["newjobban1"])
- var/mob/M = locate(href_list["newjobban1"])
- var/dat = ""
- var/header = "Pick Job to ban this guy from.
"
- var/body
-// var/list/alljobs = get_all_jobs()
- var/jobs = ""
- jobs += "Heads
"
- jobs += "Security
"
- jobs += "Engineering
"
- jobs += "Research
"
- jobs += "Medical
"
-
- jobs += "CE+Station Engineer
"
- jobs += "CE+Atmospheric Tech
"
- jobs += "CE+Shaft Miner
"
- jobs += "Chemist+RD+CMO
"
- jobs += "Geneticist+RD+CMO
"
- jobs += "MD+CMO
"
- jobs += "Virologist+RD+CMO
"
- jobs += "Scientist+RD
"
- jobs += "AI+Cyborg
"
- jobs += "Detective+HoS
"
- for(var/datum/job/job in job_master.occupations)
- if(jobban_isbanned(M, job.title))
- jobs += "[dd_replacetext(job.title, " ", " ")] "
- else
- jobs += "[dd_replacetext(job.title, " ", " ")] " //why doesn't this work the stupid cunt
-
-/* if(jobban_isbanned(M, "Captain"))
- jobs += "Captain "
- else
- jobs += "Captain " //why doesn't this work the stupid cunt
-*/
- if(jobban_isbanned(M, "Syndicate"))
- jobs += "
[dd_replacetext("Syndicate", " ", " ")] "
- else
- jobs += "
[dd_replacetext("Syndicate", " ", " ")] " //why doesn't this work the stupid cunt
-
- body = "
[jobs]
"
- dat = "[header][body]"
- usr << browse(dat, "window=jobban2;size=600x250")
- return
- if(href_list["newjobban2"])
- if ((src.rank in list("Moderator", "Administrator", "Badmin", "Tyrant" )))
- var/mob/M = locate(href_list["jobban4"])
- var/job = href_list["newjobban2"]
- if(!ismob(M)) return
- //if ((M.client && M.client.holder && (M.client.holder.level >= src.level)))
- // alert("You cannot perform this action. You must be of a higher administrative rank!")
- // return
- switch(alert("Temporary Ban?",,"Yes","No", "Cancel"))
- if("Yes")
- var/mins = input(usr,"How long (in days)?","Ban time",7) as num
- mins = mins * 24 * 60
- if(!mins)
- return
- if(mins >= 525600) mins = 525599
- var/reason = input(usr,"Reason?","reason","Griefer") as text
- if(!reason)
- return
- if(AddBanjob(M.ckey, M.computer_id, reason, usr.ckey, 1, mins, job))
- M << "\redYou have been jobbanned from [job] by [usr.client.ckey].\nReason: [reason]."
- M << "\red This is a temporary ban, it will be removed in [mins] minutes."
- if(config.banappeals)
- M << "\red To try to resolve this matter head to [config.banappeals]"
- else
- M << "\red No ban appeals URL has been set."
- ban_unban_log_save("[usr.client.ckey] has jobbanned [M.ckey] from [job]. - Reason: [reason] - This will be removed in [mins] minutes.")
- feedback_inc("ban_job",1)
- feedback_add_details("ban_job","- [job]")
- log_admin("[usr.client.ckey] has banned [M.ckey] from [job].\nReason: [reason]\nThis will be removed in [mins] minutes.")
- message_admins("\blue[usr.client.ckey] has banned [M.ckey] from [job].\nReason: [reason]\nThis will be removed in [mins] minutes.")
-
- //del(M.client)
- //del(M) // See no reason why to delete mob. Important stuff can be lost. And ban can be lifted before round ends.
- if("No")
- var/reason = input(usr,"Reason?","reason","Griefer") as text
- if(!reason)
- return
- if(AddBanjob(M.ckey, M.computer_id, reason, usr.ckey, 0, 0, job))
- M << "\redYou have been banned from [job] by [usr.client.ckey].\nReason: [reason]."
- M << "\red This is a permanent ban."
- if(config.banappeals)
- M << "\red To try to resolve this matter head to [config.banappeals]"
- else
- M << "\red No ban appeals URL has been set."
- ban_unban_log_save("[usr.client.ckey] has banned [M.ckey] from [job]. - Reason: [reason] - This is a permanent ban.")
- feedback_inc("ban_job_tmp",1)
- feedback_add_details("ban_job_tmp","- [job]")
- log_admin("[usr.client.ckey] has banned [M.ckey] from [job].\nReason: [reason]\nThis is a permanent ban.")
- message_admins("\blue[usr.client.ckey] has banned [M.ckey] from [job].\nReason: [reason]\nThis is a permanent ban.")
-
- //del(M.client)
- //del(M)
- if("Cancel")
- return
-
if(href_list["unjobbanf"])
var/banfolder = href_list["unjobbanf"]
Banlist.cd = "/base/[banfolder]"
diff --git a/code/setup.dm b/code/setup.dm
index 9dfa29e1947..716b453c1bd 100644
--- a/code/setup.dm
+++ b/code/setup.dm
@@ -370,5 +370,12 @@ var/list/liftable_structures = list(\
#define MUTE_DEADCHAT 5
#define MUTE_ALL 6
+//Number of identical messages required to get the spam-prevention automute thing to trigger warnings and automutes
#define SPAM_TRIGGER_WARNING 5
-#define SPAM_TRIGGER_AUTOMUTE 10
\ No newline at end of file
+#define SPAM_TRIGGER_AUTOMUTE 10
+
+//Some constants for DB_Ban
+#define BANTYPE_PERMA 1
+#define BANTYPE_TEMP 2
+#define BANTYPE_JOB_PERMA 3
+#define BANTYPE_JOB_TEMP 4
\ No newline at end of file
diff --git a/tgstation.dme b/tgstation.dme
index 898be86f077..b5457d7701e 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -84,6 +84,7 @@
#define FILE_DIR "code/js"
#define FILE_DIR "code/modules"
#define FILE_DIR "code/modules/admin"
+#define FILE_DIR "code/modules/admin/DB ban"
#define FILE_DIR "code/modules/admin/verbs"
#define FILE_DIR "code/modules/assembly"
#define FILE_DIR "code/modules/chemical"
@@ -186,6 +187,7 @@
#define FILE_DIR "icons/vending_icons"
#define FILE_DIR "interface"
#define FILE_DIR "maps"
+#define FILE_DIR "maps/backup"
#define FILE_DIR "maps/RandomZLevels"
#define FILE_DIR "sound"
#define FILE_DIR "sound/AI"
@@ -765,6 +767,7 @@
#include "code\modules\admin\NewBan.dm"
#include "code\modules\admin\newbanjob.dm"
#include "code\modules\admin\player_panel.dm"
+#include "code\modules\admin\DB ban\functions.dm"
#include "code\modules\admin\verbs\adminhelp.dm"
#include "code\modules\admin\verbs\adminjump.dm"
#include "code\modules\admin\verbs\adminpm.dm"