This commit is contained in:
Kashargul
2025-01-28 06:29:44 -05:00
committed by GitHub
parent dabaeea76a
commit 4ce267de40
16 changed files with 86 additions and 26 deletions
+8 -2
View File
@@ -49,6 +49,7 @@
var/validckey = 0
if(query.NextRow())
validckey = 1
qdel(query)
if(!validckey)
if(!banned_mob || (banned_mob && !IsGuestKey(banned_mob.key))) //VOREStation Edit Start.
var/confirm = tgui_alert(usr, "This ckey hasn't been seen, are you sure?", "Confirm Badmin", list("Yes", "No"))
@@ -85,7 +86,7 @@
query_insert.Execute()
to_chat(usr, span_filter_adminlog("[span_blue("Ban saved to database.")]"))
message_admins("[key_name_admin(usr)] has added a [bantype_str] for [ckey] [(job)?"([job])":""] [(duration > 0)?"([duration] minutes)":""] with the reason: \"[reason]\" to the ban database.",1)
qdel(query_insert)
/datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
@@ -135,6 +136,7 @@
while(query.NextRow())
ban_id = query.item[1]
ban_number++;
qdel(query)
if(ban_number == 0)
to_chat(usr, span_filter_adminlog("[span_red("Database update failed due to no bans fitting the search criteria. If this is not a legacy ban you should contact the database admin.")]"))
@@ -193,6 +195,7 @@
var/datum/db_query/update_query = SSdbcore.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]")
update_query.Execute()
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s reason from [reason] to [value]",1)
qdel(update_query)
if("duration")
if(!value)
value = tgui_input_number(usr, "Insert the new duration (in minutes) for [pckey]'s ban", "New Duration", "[duration]", null)
@@ -203,6 +206,7 @@
var/datum/db_query/update_query = SSdbcore.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]")
message_admins("[key_name_admin(usr)] has edited a ban for [pckey]'s duration from [duration] to [value]",1)
update_query.Execute()
qdel(update_query)
if("unban")
if(tgui_alert(usr, "Unban [pckey]?", "Unban?", list("Yes", "No")) == "Yes")
DB_ban_unban_by_id(banid)
@@ -228,7 +232,7 @@
while(query.NextRow())
pckey = query.item[1]
ban_number++;
qdel(query)
if(ban_number == 0)
to_chat(usr, span_filter_adminlog("[span_red("Database update failed due to a ban id not being present in the database.")]"))
return
@@ -249,6 +253,7 @@
var/datum/db_query/query_update = SSdbcore.NewQuery(sql_update)
query_update.Execute()
qdel(query_update)
/client/proc/DB_ban_panel()
@@ -479,5 +484,6 @@
output += "</tr>"
output += "</table></div>"
qdel(select_query)
usr << browse("<html>[output]</html>","window=lookupbans;size=900x700")
+2 -2
View File
@@ -76,9 +76,9 @@
expires = " The ban is for [duration] minutes and expires on [expiration] (server time)."
var/desc = "\nReason: You, or another user of this computer or connection ([pckey]) is banned from playing here. The ban reason is:\n[reason]\nThis ban was applied by [ackey] on [bantime], [expires]"
qdel(query)
return list("reason"="[bantype]", "desc"="[desc]")
qdel(query)
if (failedcid)
message_admins("[key] has logged in with a blank computer id in the ban check.")
if (failedip)
+1
View File
@@ -126,6 +126,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
//find the client for a ckey if they are connected and associate them with the new admin datum
D.associate(GLOB.directory[ckey])
qdel(query)
if(!admin_datums)
error("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
log_misc("The database query in load_admins() resulted in no admins being added to the list. Reverting to legacy system.")
+2
View File
@@ -85,6 +85,7 @@ DEBUG
var/job = query.item[2]
jobban_keylist.Add("[ckey] - [job]")
qdel(query)
//Job tempbans
var/datum/db_query/query1 = SSdbcore.NewQuery("SELECT ckey, job FROM erro_ban WHERE bantype = 'JOB_TEMPBAN' AND isnull(unbanned) AND expiration_time > Now()")
@@ -95,6 +96,7 @@ DEBUG
var/job = query1.item[2]
jobban_keylist.Add("[ckey] - [job]")
qdel(query1)
/proc/jobban_savebanfile()
var/savefile/S=new("data/job_full.ban")
@@ -80,18 +80,23 @@
new_admin = 0
admin_id = text2num(select_query.item[1])
qdel(select_query)
if(new_admin)
var/datum/db_query/insert_query = SSdbcore.NewQuery("INSERT INTO `erro_admin` (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, '[adm_ckey]', '[new_rank]', -1, 0)")
insert_query.Execute()
qdel(insert_query)
var/datum/db_query/log_query = SSdbcore.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]');")
log_query.Execute()
qdel(log_query)
to_chat(usr, span_filter_adminlog("[span_blue("New admin added.")]"))
else
if(!isnull(admin_id) && isnum(admin_id))
var/datum/db_query/insert_query = SSdbcore.NewQuery("UPDATE `erro_admin` SET rank = '[new_rank]' WHERE id = [admin_id]")
insert_query.Execute()
qdel(insert_query)
var/datum/db_query/log_query = SSdbcore.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]');")
log_query.Execute()
qdel(log_query)
to_chat(usr, span_filter_adminlog("[span_blue("Admin rank changed.")]"))
/datum/admins/proc/log_admin_permission_modification(var/adm_ckey, var/new_permission)
@@ -131,19 +136,23 @@
while(select_query.NextRow())
admin_id = text2num(select_query.item[1])
admin_rights = text2num(select_query.item[2])
qdel(select_query)
if(!admin_id)
return
if(admin_rights & new_permission) //This admin already has this permission, so we are removing it.
var/datum/db_query/insert_query = SSdbcore.NewQuery("UPDATE `erro_admin` SET flags = [admin_rights & ~new_permission] WHERE id = [admin_id]")
insert_query.Execute()
qdel(insert_query)
var/datum/db_query/log_query = SSdbcore.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]');")
log_query.Execute()
qdel(log_query)
to_chat(usr, span_filter_adminlog("[span_blue("Permission removed.")]"))
else //This admin doesn't have this permission, so we are adding it.
var/datum/db_query/insert_query = SSdbcore.NewQuery("UPDATE `erro_admin` SET flags = '[admin_rights | new_permission]' WHERE id = [admin_id]")
insert_query.Execute()
qdel(insert_query)
var/datum/db_query/log_query = SSdbcore.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]')")
log_query.Execute()
qdel(log_query)
to_chat(usr, span_filter_adminlog("[span_blue("Permission added.")]"))
@@ -63,14 +63,16 @@ var/inactive_keys = "None<br>"
if(ckeys_with_customitems.Find(cur_ckey))
ckeys_with_customitems.Remove(cur_ckey)
inactive_ckeys[cur_ckey] = "last seen on [query_inactive.item[2]]"
qdel(query_inactive)
//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/datum/db_query/query_inactive = SSdbcore.NewQuery("SELECT ckey FROM erro_player WHERE ckey = '[cur_ckey]'")
query_inactive.Execute()
if(!query_inactive.rows)
if(!length(query_inactive.rows))
inactive_ckeys += cur_ckey
qdel(query_inactive)
if(inactive_ckeys.len)
inactive_keys = ""