to_chat replacing stream operator

This commit is contained in:
Arokha Sieyes
2020-02-17 13:14:08 -05:00
committed by Leshana
parent 5aaba55222
commit 5b15917d32
712 changed files with 4250 additions and 4220 deletions
+13 -13
View File
@@ -82,7 +82,7 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration =
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/DBQuery/query_insert = dbcon.NewQuery(sql)
query_insert.Execute()
usr << "<font color='blue'>Ban saved to database.</font>"
to_chat(usr, "<font color='blue'>Ban saved to database.</font>")
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)
@@ -136,17 +136,17 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
ban_number++;
if(ban_number == 0)
usr << "<font color='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.</font>"
to_chat(usr, "<font color='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.</font>")
return
if(ban_number > 1)
usr << "<font color='red'>Database update failed due to multiple bans fitting the search criteria. Note down the ckey, job and current time and contact the database admin.</font>"
to_chat(usr, "<font color='red'>Database update failed due to multiple bans fitting the search criteria. Note down the ckey, job and current time and contact the database admin.</font>")
return
if(istext(ban_id))
ban_id = text2num(ban_id)
if(!isnum(ban_id))
usr << "<font color='red'>Database update failed due to a ban ID mismatch. Contact the database admin.</font>"
to_chat(usr, "<font color='red'>Database update failed due to a ban ID mismatch. Contact the database admin.</font>")
return
DB_ban_unban_by_id(ban_id)
@@ -156,7 +156,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
if(!check_rights(R_BAN)) return
if(!isnum(banid) || !istext(param))
usr << "Cancelled"
to_chat(usr, "Cancelled")
return
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, duration, reason FROM erro_ban WHERE id = [banid]")
@@ -172,7 +172,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
duration = query.item[2]
reason = query.item[3]
else
usr << "Invalid ban id. Contact the database admin"
to_chat(usr, "Invalid ban id. Contact the database admin")
return
reason = sql_sanitize_text(reason)
@@ -184,7 +184,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
value = sanitize(input("Insert the new reason for [pckey]'s ban", "New Reason", "[reason]", null) as null|text)
value = sql_sanitize_text(value)
if(!value)
usr << "Cancelled"
to_chat(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]")
@@ -194,7 +194,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
if(!value)
value = input("Insert the new duration (in minutes) for [pckey]'s ban", "New Duration", "[duration]", null) as null|num
if(!isnum(value) || !value)
usr << "Cancelled"
to_chat(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]")
@@ -205,10 +205,10 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
DB_ban_unban_by_id(banid)
return
else
usr << "Cancelled"
to_chat(usr, "Cancelled")
return
else
usr << "Cancelled"
to_chat(usr, "Cancelled")
return
datum/admins/proc/DB_ban_unban_by_id(var/id)
@@ -231,11 +231,11 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
ban_number++;
if(ban_number == 0)
usr << "<font color='red'>Database update failed due to a ban id not being present in the database.</font>"
to_chat(usr, "<font color='red'>Database update failed due to a ban id not being present in the database.</font>")
return
if(ban_number > 1)
usr << "<font color='red'>Database update failed due to multiple bans having the same ID. Contact the database admin.</font>"
to_chat(usr, "<font color='red'>Database update failed due to multiple bans having the same ID. Contact the database admin.</font>")
return
if(!src.owner || !istype(src.owner, /client))
@@ -271,7 +271,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
establish_db_connection()
if(!dbcon.IsConnected())
usr << "<font color='red'>Failed to establish database connection</font>"
to_chat(usr, "<font color='red'>Failed to establish database connection</font>")
return
var/output = "<div align='center'><table width='90%'><tr>"