mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-09 06:04:23 +01:00
adds forum link, removes boxen discord table
This commit is contained in:
@@ -150,6 +150,8 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration =
|
||||
|
||||
if(isjobban)
|
||||
jobban_client_fullban(ckey, job)
|
||||
else
|
||||
flag_account_for_forum_sync(ckey)
|
||||
|
||||
datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
|
||||
|
||||
@@ -228,6 +230,8 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
|
||||
DB_ban_unban_by_id(ban_id)
|
||||
if(isjobban)
|
||||
jobban_unban_client(ckey, job)
|
||||
else
|
||||
flag_account_for_forum_sync(ckey)
|
||||
|
||||
datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null)
|
||||
|
||||
@@ -333,6 +337,8 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
||||
var/DBQuery/query_update = dbcon.NewQuery(sql_update)
|
||||
query_update.Execute()
|
||||
|
||||
flag_account_for_forum_sync(pckey)
|
||||
|
||||
|
||||
/client/proc/DB_ban_panel()
|
||||
set category = "Admin"
|
||||
@@ -566,4 +572,11 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
|
||||
|
||||
output += "</table></div>"
|
||||
|
||||
usr << browse(output,"window=lookupbans;size=900x700")
|
||||
usr << browse(output,"window=lookupbans;size=900x700")
|
||||
|
||||
/proc/flag_account_for_forum_sync(var/ckey)
|
||||
if(!dbcon)
|
||||
return
|
||||
var/sql = "UPDATE [format_table_name("player")] SET fupdate = 1 WHERE ckey = '[ckey]'"
|
||||
var/DBQuery/adm_query = dbcon.NewQuery(sql)
|
||||
adm_query.Execute()
|
||||
|
||||
@@ -229,7 +229,8 @@
|
||||
if(href_list["ssdwarning"])
|
||||
ssd_warning_acknowledged = TRUE
|
||||
to_chat(src, "<span class='notice'>SSD warning acknowledged.</span>")
|
||||
|
||||
if(href_list["link_forum_account"])
|
||||
link_forum_account()
|
||||
switch(href_list["action"])
|
||||
if("openLink")
|
||||
src << link(href_list["link"])
|
||||
@@ -393,6 +394,8 @@
|
||||
generate_clickcatcher()
|
||||
apply_clickcatcher()
|
||||
|
||||
check_forum_link()
|
||||
|
||||
if(custom_event_msg && custom_event_msg != "")
|
||||
to_chat(src, "<h1 class='alert'>Custom Event</h1>")
|
||||
to_chat(src, "<h2 class='alert'>A custom event is taking place. OOC Info:</h2>")
|
||||
@@ -576,6 +579,46 @@
|
||||
message_admins("<span class='adminnotice'>IPIntel: [key_name_admin(src)] on IP [address] is likely to be using a Proxy/VPN. [detailsurl]</span>")
|
||||
|
||||
|
||||
/client/proc/check_forum_link()
|
||||
if(config.forum_link_url && prefs && !prefs.fuid)
|
||||
to_chat(src, "<B>You do not have your forum account linked. <a href='?src=[UID()];link_forum_account=true'>LINK FORUM ACCOUNT</a></B>")
|
||||
|
||||
/client/proc/create_oauth_token()
|
||||
var/DBQuery/query_find_token = dbcon.NewQuery("SELECT token FROM [format_table_name("oauth_tokens")] WHERE ckey = '[ckey]' limit 1")
|
||||
if(!query_find_token.Execute())
|
||||
log_debug("create_oauth_token: failed db read")
|
||||
return
|
||||
if(query_find_token.NextRow())
|
||||
return query_find_token.item[1]
|
||||
var/tokenstr = md5("[ckey][rand()]")
|
||||
var/DBQuery/query_insert_token = dbcon.NewQuery("INSERT INTO [format_table_name("oauth_tokens")] (ckey, token) VALUES('[ckey]','[tokenstr]')")
|
||||
if(!query_insert_token.Execute())
|
||||
return
|
||||
return tokenstr
|
||||
|
||||
/client/proc/link_forum_account()
|
||||
if(IsGuestKey(key))
|
||||
to_chat(src, "Guest keys cannot be linked.")
|
||||
return
|
||||
if(prefs && prefs.fuid)
|
||||
to_chat(src, "Your forum account is already set.")
|
||||
return
|
||||
var/DBQuery/query_find_link = dbcon.NewQuery("SELECT fuid FROM [format_table_name("player")] WHERE ckey = '[ckey]' limit 1")
|
||||
if(!query_find_link.Execute())
|
||||
log_debug("link_forum_account: failed db read")
|
||||
return
|
||||
if(query_find_link.NextRow())
|
||||
if(query_find_link.item[1])
|
||||
to_chat(src, "Your forum account is already set. (" + query_find_link.item[1] + ")")
|
||||
return
|
||||
var/tokenid = create_oauth_token()
|
||||
if(!tokenid)
|
||||
to_chat(src, "link_forum_account: unable to create token")
|
||||
return
|
||||
var/url = "[config.forum_link_url][tokenid]"
|
||||
to_chat(src, {"Now opening a windows to verify your information with the forums. If the window does not load, please go to: <a href="[url]">[url]</a>."})
|
||||
src << link(url)
|
||||
return
|
||||
|
||||
#undef TOPIC_SPAM_DELAY
|
||||
#undef UPLOAD_LIMIT
|
||||
|
||||
@@ -92,6 +92,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
|
||||
var/windowflashing = TRUE
|
||||
var/clientfps = 0
|
||||
var/atklog = ATKLOG_ALL
|
||||
var/fuid // forum userid
|
||||
|
||||
//ghostly preferences
|
||||
var/ghost_anonsay = 0
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
ghost_anonsay,
|
||||
exp,
|
||||
clientfps,
|
||||
atklog
|
||||
atklog,
|
||||
fuid
|
||||
FROM [format_table_name("player")]
|
||||
WHERE ckey='[C.ckey]'"}
|
||||
)
|
||||
@@ -50,6 +51,7 @@
|
||||
exp = query.item[16]
|
||||
clientfps = text2num(query.item[17])
|
||||
atklog = text2num(query.item[18])
|
||||
fuid = text2num(query.item[19])
|
||||
|
||||
//Sanitize
|
||||
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
|
||||
@@ -69,6 +71,7 @@
|
||||
exp = sanitize_text(exp, initial(exp))
|
||||
clientfps = sanitize_integer(clientfps, 0, 1000, initial(clientfps))
|
||||
atklog = sanitize_integer(atklog, 0, 100, initial(atklog))
|
||||
fuid = sanitize_integer(fuid, 0, 10000000, initial(fuid))
|
||||
return 1
|
||||
|
||||
/datum/preferences/proc/save_preferences(client/C)
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// DONT TOUCH ANYTHING IN HERE UNLESS YOU KNOW WHAT YOU ARE DOING -affected
|
||||
/client/verb/linkdiscord()
|
||||
set category = "Special Verbs"
|
||||
set name = "Link Discord Account"
|
||||
set desc = "Link your discord account to your BYOND account."
|
||||
var/user_ckey = sanitizeSQL(usr.ckey) // Probably not neccassary but better safe than sorry
|
||||
if(!config.sql_enabled)
|
||||
to_chat(src, "<span class='warning'>This is feature requires the SQL backend</span>")
|
||||
return
|
||||
var/DBQuery/db_discord_id = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE ckey = '[user_ckey]'")
|
||||
if(!db_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while selecting discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error checking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
var/stored_id
|
||||
while(db_discord_id.NextRow())
|
||||
stored_id = db_discord_id.item[1]
|
||||
if(!stored_id) // Not linked
|
||||
var/know_how = alert("Do you know how to get a discord user ID? This ID is NOT your discord username and numbers!","Question","Yes","No")
|
||||
if(know_how == "No") // Opens discord support on how to collect IDs
|
||||
src << link("https://support.discordapp.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID")
|
||||
var/entered_id = input("Please enter your Discord ID.", "Enter Discord ID", null, null) as text|null
|
||||
var/sql_id = sanitizeSQL(entered_id)
|
||||
var/DBQuery/store_discord_id = dbcon.NewQuery("INSERT INTO [format_table_name("discord")] (ckey, discord_id, notify) VALUES ('[user_ckey]', [sql_id], 0)")
|
||||
if(!store_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while linking discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error linking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>Successfully linked discord account [entered_id] to [user_ckey]</span>")
|
||||
else // Linked
|
||||
var/choice = alert("You already have the Discord Account [stored_id] linked to [user_ckey]. Would you like to unlink or replace","Already Linked","Unlink","Replace")
|
||||
switch(choice)
|
||||
if("Unlink")
|
||||
var/DBQuery/unlink_discord_id = dbcon.NewQuery("DELETE FROM [format_table_name("discord")] WHERE ckey = '[user_ckey]'")
|
||||
if(!unlink_discord_id.Execute())
|
||||
var/err = unlink_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while unlinking discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error unlinking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>Successfully unlinked discord account</span>")
|
||||
if("Replace")
|
||||
var/entered_id = input("Please enter your Discord ID. Instructions can be found at https://bit.ly/2AfUu40", "Enter Discord ID", null, null) as text|null
|
||||
var/sql_id = sanitizeSQL(entered_id)
|
||||
var/DBQuery/store_discord_id = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET discord_id = '[sql_id]' WHERE ckey='[user_ckey]'")
|
||||
if(!store_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
to_chat(src, "<span class='warning'>Error replacing Discord account. Please inform an administrator</span>")
|
||||
log_game("SQL ERROR while linking discord account. Error : \[[err]\]\n")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>Successfully linked discord account [entered_id] to [user_ckey]</span>")
|
||||
@@ -1,48 +0,0 @@
|
||||
// DONT TOUCH ANYTHING IN HERE UNLESS YOU KNOW WHAT YOU ARE DOING -affected
|
||||
/client/verb/notify_restart()
|
||||
set category = "Special Verbs"
|
||||
set name = "Notify Restart"
|
||||
set desc = "Notifies you on Discord when the server restarts."
|
||||
if(!config.sql_enabled)
|
||||
to_chat(src, "<span class='warning'>This is feature requires the SQL backend</span>")
|
||||
return
|
||||
var/DBQuery/db_discord_id = dbcon.NewQuery("SELECT discord_id FROM [format_table_name("discord")] WHERE ckey = '[ckey]'")
|
||||
if(!db_discord_id.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
log_game("SQL ERROR while selecting discord account. Error : \[[err]\]\n")
|
||||
to_chat(src, "<span class='warning'>Error checking Discord account. Please inform an administrator</span>")
|
||||
return
|
||||
var/stored_id
|
||||
while(db_discord_id.NextRow())
|
||||
stored_id = db_discord_id.item[1]
|
||||
if(!stored_id) // Not linked
|
||||
to_chat(src, "<span class='warning'>This requires you to link your Discord account with the \"Link Discord Account\" verb.</span>")
|
||||
return
|
||||
else // Linked
|
||||
var/DBQuery/toggle_status = dbcon.NewQuery("SELECT notify FROM [format_table_name("discord")] WHERE ckey = '[ckey]'")
|
||||
if(!toggle_status.Execute())
|
||||
var/err = toggle_status.ErrorMsg()
|
||||
log_game("SQL ERROR while getting discord account. Error : \[[err]\]\n")
|
||||
var/notify_status
|
||||
while(toggle_status.NextRow())
|
||||
notify_status = toggle_status.item[1]
|
||||
if(notify_status) // Data is there
|
||||
switch(notify_status)
|
||||
if("0")
|
||||
var/DBQuery/update_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 1 WHERE ckey='[ckey]'")
|
||||
if(!update_notify.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
to_chat(src, "<span class='warning'>Error updating notify status. Please inform an administrator</span>")
|
||||
log_game("SQL ERROR while updating notify status. Error : \[[err]\]\n")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>You will now be notified on discord when the next round is starting</span>")
|
||||
if("1")
|
||||
var/DBQuery/update_notify = dbcon.NewQuery("UPDATE [format_table_name("discord")] SET notify = 0 WHERE ckey='[ckey]'")
|
||||
if(!update_notify.Execute())
|
||||
var/err = db_discord_id.ErrorMsg()
|
||||
to_chat(src, "<span class='warning'>Error updating notify status. Please inform an administrator</span>")
|
||||
log_game("SQL ERROR while updating notify status. Error : \[[err]\]\n")
|
||||
return
|
||||
to_chat(src, "<span class='notice'>You will no longer be notified on discord when the next round is starting</span>")
|
||||
else // Oh fuck what the hell happened
|
||||
to_chat(src, "<span class='danger'>Something has gone VERY wrong, or affected cant code.</span>")
|
||||
Reference in New Issue
Block a user