This commit is contained in:
LetterJay
2018-08-23 07:20:49 -05:00
parent 15fd819c29
commit 1b11773cd9
27 changed files with 323 additions and 277 deletions
+32 -3
View File
@@ -360,6 +360,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
send2irc_adminless_only("new_byond_user", "[key_name(src)] (IP: [address], ID: [computer_id]) is a new BYOND account [account_age] day[(account_age==1?"":"s")] old, created on [account_join_date].")
get_message_output("watchlist entry", ckey)
check_ip_intel()
validate_key_in_db()
send_resources()
@@ -507,7 +508,8 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
new_player = 1
account_join_date = sanitizeSQL(findJoinDate())
var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])")
var/sql_key = sanitizeSQL(key)
var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `byond_key`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', '[sql_key]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])")
if(!query_add_player.Execute())
qdel(query_client_in_db)
qdel(query_add_player)
@@ -558,7 +560,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
/client/proc/findJoinDate()
var/list/http = world.Export("http://byond.com/members/[ckey]?format=text")
if(!http)
log_world("Failed to connect to byond age check for [ckey]")
log_world("Failed to connect to byond member page to age check [ckey]")
return
var/F = file2text(http["CONTENT"])
if(F)
@@ -568,6 +570,33 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
else
CRASH("Age check regex failed for [src.ckey]")
/client/proc/validate_key_in_db()
var/sql_ckey = sanitizeSQL(ckey)
var/sql_key
var/datum/DBQuery/query_check_byond_key = SSdbcore.NewQuery("SELECT byond_key FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'")
if(!query_check_byond_key.Execute())
qdel(query_check_byond_key)
return
if(query_check_byond_key.NextRow())
sql_key = query_check_byond_key.item[1]
qdel(query_check_byond_key)
if(key != sql_key)
var/list/http = world.Export("http://byond.com/members/[ckey]?format=text")
if(!http)
log_world("Failed to connect to byond member page to get changed key for [ckey]")
return
var/F = file2text(http["CONTENT"])
if(F)
var/regex/R = regex("\\tkey = \"(.+)\"")
if(R.Find(F))
var/web_key = sanitizeSQL(R.group[1])
var/datum/DBQuery/query_update_byond_key = SSdbcore.NewQuery("UPDATE [format_table_name("player")] SET byond_key = '[web_key]' WHERE ckey = '[sql_ckey]'")
query_update_byond_key.Execute()
qdel(query_update_byond_key)
else
CRASH("Key check regex failed for [ckey]")
/client/proc/check_randomizer(topic)
. = FALSE
if (connection != "seeker")
@@ -676,7 +705,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
qdel(query_get_notes)
return
qdel(query_get_notes)
create_message("note", ckey, system_ckey, message, null, null, 0, 0)
create_message("note", key, system_ckey, message, null, null, 0, 0)
/client/proc/check_ip_intel()
+8 -8
View File
@@ -372,7 +372,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "</td>"
if(CONFIG_GET(flag/join_with_mutant_humans))
@@ -525,7 +525,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
else
dat += "<b>Be [capitalize(i)]:</b> <a href='?_src_=prefs;preference=be_special;be_special_type=[i]'>[(i in be_special) ? "Yes" : "No"]</a><br>"
dat += "<table><tr><td width='340px' height='300px' valign='top'>"
dat += "<h2>Citadel Preferences</h2>" //Because fuck me if preferences can't be fucking modularized and expected to update in a reasonable timeframe.
dat += "<h2>Citadel Preferences</h2>" //Because fuck me if preferences can't be fucking modularized and expected to update in a reasonable timeframe.
dat += "<b>Arousal:</b><a href='?_src_=prefs;preference=arousable'>[arousable == TRUE ? "Enabled" : "Disabled"]</a><BR>"
dat += "<b>Exhibitionist:</b><a href='?_src_=prefs;preference=exhibitionist'>[features["exhibitionist"] == TRUE ? "Yes" : "No"]</a><BR>"
dat += "<b>Allow MediHound sleeper:</b> <a href='?_src_=prefs;preference=hound_sleeper'>[(cit_toggles & MEDIHOUND_SLEEPER) ? "Yes" : "No"]</a><br>"
@@ -939,7 +939,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(href_list["jobbancheck"])
var/job = sanitizeSQL(href_list["jobbancheck"])
var/sql_ckey = sanitizeSQL(user.ckey)
var/datum/DBQuery/query_get_jobban = SSdbcore.NewQuery("SELECT reason, bantime, duration, expiration_time, a_ckey FROM [format_table_name("ban")] WHERE ckey = '[sql_ckey]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned) AND job = '[job]'")
var/datum/DBQuery/query_get_jobban = SSdbcore.NewQuery("SELECT reason, bantime, duration, expiration_time, (SELECT byond_key FROM [format_table_name("player")] WHERE [format_table_name("player")].ckey = [format_table_name("ban")].a_ckey) FROM [format_table_name("ban")] WHERE ckey = '[sql_ckey]' AND (bantype = 'JOB_PERMABAN' OR (bantype = 'JOB_TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned) AND job = '[job]'")
if(!query_get_jobban.warn_execute())
return
if(query_get_jobban.NextRow())
@@ -947,9 +947,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/bantime = query_get_jobban.item[2]
var/duration = query_get_jobban.item[3]
var/expiration_time = query_get_jobban.item[4]
var/a_ckey = query_get_jobban.item[5]
var/admin_key = query_get_jobban.item[5]
var/text
text = "<span class='redtext'>You, or another user of this computer, ([user.ckey]) is banned from playing [job]. The ban reason is:<br>[reason]<br>This ban was applied by [a_ckey] on [bantime]"
text = "<span class='redtext'>You, or another user of this computer, ([user.key]) is banned from playing [job]. The ban reason is:<br>[reason]<br>This ban was applied by [admin_key] on [bantime]"
if(text2num(duration) > 0)
text += ". The ban is for [duration] minutes and expires on [expiration_time] (server time)"
text += ".</span>"
@@ -1223,7 +1223,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/new_tail
new_tail = input(user, "Choose your character's tail:", "Character Preference") as null|anything in GLOB.tails_list_human
if(new_tail)
features["tail_human"] = new_tail
features["tail_human"] = new_tail
if("snout")
var/new_snout
@@ -1413,9 +1413,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("balls_internal")
features["balls_internal"] = !features["balls_internal"]
if("eggsack_internal")
features["eggsack_internal"] = !features["eggsack_internal"]
features["eggsack_internal"] = !features["eggsack_internal"]
if("has_breasts")
features["has_breasts"] = !features["has_breasts"]
features["has_breasts"] = !features["has_breasts"]
if("has_vag")
features["has_vag"] = !features["has_vag"]
if("has_womb")