Conflict resolution

Merge remote-tracking branch 'Aurorastation/development'

# Conflicts:
#	config/example/config.txt
This commit is contained in:
skull132
2016-03-25 22:25:41 +02:00
45 changed files with 749 additions and 289 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
if (!ckey || !address || !computer_id || !ban_id)
return
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
error("Ban database connection failure while attempting to mirror. Key passed for mirror handling: [ckey].")
+4 -4
View File
@@ -4,7 +4,7 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration =
if(!check_rights(R_MOD,0) && !check_rights(R_BAN)) return
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return
@@ -122,7 +122,7 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "")
if(job)
sql += " AND job = '[job]'"
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return
@@ -217,7 +217,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
var/sql = "SELECT ckey FROM ss13_ban WHERE id = [id]"
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return
@@ -269,7 +269,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
if(!check_rights(R_BAN)) return
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
usr << "\red Failed to establish database connection"
return
+1 -1
View File
@@ -34,7 +34,7 @@ world/IsBanned(key,address,computer_id)
var/ckeytext = ckey(key)
if(!establish_db_connection())
if(!establish_db_connection(dbcon))
error("Ban database connection failure. Key [ckeytext] not checked")
log_misc("Ban database connection failure. Key [ckeytext] not checked")
return
+1 -1
View File
@@ -102,7 +102,7 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
else
//The current admin system uses SQL
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
error("Failed to connect to database in load_admins(). Reverting to legacy system.")
log_misc("Failed to connect to database in load_admins(). Reverting to legacy system.")
+1 -1
View File
@@ -65,7 +65,7 @@ DEBUG
jobban_keylist=list()
log_admin("jobban_keylist was empty")
else
if(!establish_db_connection())
if(!establish_db_connection(dbcon))
error("Database connection failed. Reverting to the legacy ban system.")
log_misc("Database connection failed. Reverting to the legacy ban system.")
config.ban_legacy_system = 1
@@ -54,7 +54,7 @@
usr << "\red You do not have permission to do this!"
return
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
usr << "\red Failed to establish database connection"
@@ -104,7 +104,7 @@
usr << "\red You do not have permission to do this!"
return
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
usr << "\red Failed to establish database connection"
return
+5 -5
View File
@@ -12,7 +12,7 @@
else
query_details[":a_ckey"] = user.ckey
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
alert("SQL connection failed while trying to add a note!")
return
@@ -36,7 +36,7 @@
if (!note_id || !note_edit)
return
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
error("SQL connection failed while attempting to delete a note!")
return
@@ -93,7 +93,7 @@
player_ckey = ckey(player_ckey)
admin_ckey = ckey(admin_ckey)
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
error("SQL connection failed while attempting to view a player's notes!")
return
@@ -187,7 +187,7 @@
if (!ckey)
return "No ckey given!"
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
return "Unable to establish database connection! Aborting!"
@@ -231,7 +231,7 @@
note_list >> note_keys
msg_scopes("Establishing DB connection!")
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
msg_scopes("No DB connection!")
return
@@ -29,7 +29,7 @@ var/inactive_keys = "None<br>"
if(checked_for_inactives)
return
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return
+6 -6
View File
@@ -9,7 +9,7 @@
if (!warned_ckey || !istext(warned_ckey))
return
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
usr << "<font color='red'>Error: warn(): Database Connection failed, reverting to legacy systems.</font>"
usr.client.warn_legacy(warned_ckey)
@@ -110,7 +110,7 @@
var/dcolor = "#ffaaaa" //dark colour, severity = 1
var/ecolor = "#e3e3e3" //gray colour, expired = 1
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
alert("Connection to the SQL database lost. Aborting. Please alert an Administrator or a member of staff.")
return
@@ -172,7 +172,7 @@
if (!warning_id)
return
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
alert("Connection to SQL database failed while attempting to update your warning's status!")
return
@@ -191,7 +191,7 @@
var/count = 0
var/count_expire = 0
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
return
@@ -239,7 +239,7 @@
var/dcolor = "#ffdddd" //dark colour, severity = 1
var/ecolor = "#e3e3e3" //gray colour, expired = 1
establish_db_connection()
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
alert("Connection to the SQL database lost. Aborting. Please alert the database admin!")
return
@@ -342,7 +342,7 @@
if(!warning_id || !warning_edit)
return
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
alert("Connection to the SQL database lost. Aborting. Please alert the database admin!")
return
+157 -5
View File
@@ -74,7 +74,68 @@
if(href_list["warnview"])
warnings_check()
..() //redirect to hsrc.Topic()
if(href_list["linkingrequest"])
if (!config.webint_url)
return
if (!href_list["linkingaction"])
return
var/request_id = text2num(href_list["linkingrequest"])
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
src << "\red Action failed! Database link could not be established!"
return
var/DBQuery/check_query = dbcon.NewQuery("SELECT player_ckey, status FROM ss13_player_linking WHERE id = :id")
check_query.Execute(list(":id" = request_id))
if (!check_query.NextRow())
src << "\red No request found!"
return
if (ckey(check_query.item[1]) != ckey || check_query.item[2] != "new")
src << "\red Request authentication failed!"
return
var/query_contents = ""
var/list/query_details = list(":new_status", ":id")
var/feedback_message = ""
switch (href_list["linkingaction"])
if ("accept")
query_contents = "UPDATE ss13_player_linking SET status = :new_status, updated_at = NOW() WHERE id = :id"
query_details[":new_status"] = "confirmed"
query_details[":id"] = request_id
feedback_message = "<font color='green'><b>Account successfully linked!</b></font>"
if ("deny")
query_contents = "UPDATE ss13_player_linking SET status = :new_status, deleted_at = NOW() WHERE id = :id"
query_details[":new_status"] = "rejected"
query_details[":id"] = request_id
feedback_message = "<font color='red'><b>Link request rejected!</b></font>"
else
src << "\red Invalid command sent."
return
var/DBQuery/update_query = dbcon.NewQuery(query_contents)
update_query.Execute(query_details)
if (href_list["linkingaction"] == "accept" && alert("To complete the process, you have to visit the website. Do you want to do so now?",,"Yes","No") == "Yes")
process_webint_link("interface/user/link")
src << feedback_message
check_linking_requests()
return
if (href_list["routeWebInt"])
process_webint_link(href_list["routeWebInt"], href_list["routeAttributes"])
return
..() //redirect to hsrc.()
/client/proc/handle_spam_prevention(var/message, var/mute_type)
if(config.automute_on && !holder && src.last_message == message)
@@ -175,6 +236,8 @@
log_client_to_db()
check_linking_requests()
send_resources()
nanomanager.send_resources(src)
@@ -203,7 +266,7 @@
// Returns null if no DB connection can be established, or -1 if the requested key was not found in the database
/proc/get_player_age(key)
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return null
@@ -223,7 +286,7 @@
if ( IsGuestKey(src.key) )
return
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return
@@ -344,12 +407,101 @@
)
mob/proc/MayRespawn()
/mob/proc/MayRespawn()
return 0
client/proc/MayRespawn()
/client/proc/MayRespawn()
if(mob)
return mob.MayRespawn()
// Something went wrong, client is usually kicked or transfered to a new mob at this point
return 0
//I honestly can't find a good place for this atm.
//If the webint interaction gets more features, I'll move it. - Skull132
/client/verb/view_linking_requests()
set name = "View Linking Requests"
set category = "OOC"
check_linking_requests()
/client/proc/check_linking_requests()
if (!config.webint_url || !config.sql_enabled)
return
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
return
var/list/requests = list()
var/list/query_details = list(":ckey" = ckey)
var/DBQuery/select_query = dbcon.NewQuery("SELECT id, forum_id, forum_username, datediff(Now(), created_at) as request_age FROM ss13_player_linking WHERE status = 'new' AND player_ckey = :ckey AND deleted_at IS NULL")
select_query.Execute(query_details)
while (select_query.NextRow())
requests.Add(list(list("id" = text2num(select_query.item[1]), "forum_id" = text2num(select_query.item[2]), "forum_username" = select_query.item[3], "request_age" = select_query.item[4])))
if (!requests.len)
return
var/dat = "<center><b>You have active requests to check!</b></center>"
var/i = 0
for (var/list/request in requests)
i++
var/linked_forum_name = null
if (config.forumurl)
var/route_attributes = list2params(list("mode" = "viewprofile", "u" = request["forum_id"]))
linked_forum_name = "<a href='byond://?src=\ref[src];routeWebInt=forums/members;routeAttributes=[route_attributes]'>[request["forum_username"]]</a>"
dat += "<hr>"
dat += "#[i] - Request to link your current key ([key]) to a forum account with the username of: <b>[linked_forum_name ? linked_forum_name : request["forum_username"]]</b>.<br>"
dat += "The request is [request["request_age"]] days old.<br>"
dat += "OPTIONS: <a href='byond://?src=\ref[src];linkingrequest=[request["id"]];linkingaction=accept'>Accept Request</a> | <a href='byond://?src=\ref[src];linkingrequest=[request["id"]];linkingaction=deny'>Deny Request</a>"
src << browse(dat, "window=LinkingRequests")
return
/client/proc/process_webint_link(var/route, var/attributes)
if (!route)
return
var/linkURL = ""
switch (route)
if ("forums/members")
if (!webint_validate_attributes(list("mode", "u"), attributes_text = attributes))
return
if (!config.forumurl)
return
linkURL = "[config.forumurl]memberlist.php?"
linkURL += attributes
if ("interface/user/link")
if (!config.webint_url)
return
linkURL = "[config.webint_url]user/link"
if ("interface/login/sso_server")
//This also validates the attributes as it runs
var/new_attributes = webint_start_singlesignon(src, attributes)
if (!new_attributes)
return
if (!config.webint_url)
return
linkURL = "[config.webint_url]login/sso_server?"
linkURL += new_attributes
else
log_debug("Unrecognized process_webint_link() call used. Route sent: '[route]'.")
return
src << link(linkURL)
return
+18
View File
@@ -110,6 +110,24 @@
prescription = 1
body_parts_covered = 0
/obj/item/clothing/glasses/regular/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/clothing/glasses/hud/health))
user.drop_item()
del(W)
user << "<span class='notice'>You attach a set of medical HUDs to your glasses.</span>"
var/turf/T = get_turf(src)
new /obj/item/clothing/glasses/hud/health/prescription(T)
user.drop_from_inventory(src)
del(src)
if(istype(W, /obj/item/clothing/glasses/hud/security))
user.drop_item()
del(W)
user << "<span class='notice'>You attach a set of security HUDs to your glasses.</span>"
var/turf/T = get_turf(src)
new /obj/item/clothing/glasses/hud/security/prescription(T)
user.drop_from_inventory(src)
del(src)
/obj/item/clothing/glasses/regular/scanners
name = "Scanning Goggles"
desc = "A very oddly shaped pair of goggles with bits of wire poking out the sides. A soft humming sound emanates from it."
+30
View File
@@ -20,6 +20,21 @@
/obj/item/clothing/glasses/hud/health/process_hud(var/mob/M)
process_med_hud(M, 1)
/obj/item/clothing/glasses/hud/health/prescription
name = "prescription glasses/HUD assembly"
desc = "A medical HUD clipped onto the side of prescription glasses."
prescription = 1
icon_state = "healthhudpresc"
item_state = "healthhudpresc"
/obj/item/clothing/glasses/hud/health/prescription/attack_self(mob/user)
user << "<span class='notice'>You detach a set of medical HUDs form your glasses.</span>"
var/turf/T = get_turf(src)
new /obj/item/clothing/glasses/hud/health(T)
new /obj/item/clothing/glasses/regular(T)
user.drop_item(src)
del(src)
/obj/item/clothing/glasses/hud/security
name = "Security HUD"
desc = "A heads-up display that scans the humans in view and provides accurate data about their ID status and security records."
@@ -27,6 +42,21 @@
body_parts_covered = 0
var/global/list/jobs[0]
/obj/item/clothing/glasses/hud/security/prescription
name = "prescription glasses/HUD assembly"
desc = "A security HUD clipped onto the side of prescription glasses."
prescription = 1
icon_state = "sechudpresc"
item_state = "sechudpresc"
/obj/item/clothing/glasses/hud/security/prescription/attack_self(mob/user)
user << "<span class='notice'>You detach a set of security HUDs form your glasses.</span>"
var/turf/T = get_turf(src)
new /obj/item/clothing/glasses/hud/health(T)
new /obj/item/clothing/glasses/regular(T)
user.drop_item(src)
del(src)
/obj/item/clothing/glasses/hud/security/jensenshades
name = "Augmented shades"
desc = "Polarized bioneural eyewear, designed to augment your vision."
+4 -4
View File
@@ -43,7 +43,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>
<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"}
if(1)
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font><BR>"
else if(!SQLquery)
@@ -189,7 +189,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"}
if(4)
dat += "<h3>External Archive</h3>"
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
else
@@ -332,7 +332,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
if(scanner.cache.unique)
alert("This book has been rejected from the database. Aborting!")
else
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
alert("Connection to Archive has been severed. Aborting.")
else
@@ -356,7 +356,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
if(href_list["targetid"])
var/sqlid = sanitizeSQL(href_list["targetid"])
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
alert("Connection to Archive has been severed. Aborting.")
if(bibledelay)
+1 -1
View File
@@ -19,4 +19,4 @@
/datum/language/tajaran/monkey
name = "Farwa"
desc = "Meow meow meow."
key = "9"
key = "^"
+1 -1
View File
@@ -71,7 +71,7 @@
desc = "Vaurca native language made of clicks and sputters, \"It's a bugs life.\""
speech_verb = "clicks"
colour = "vaurca"
key = "m"
key = "9"
flags = WHITELISTED
syllables = list("kic","klic","\'tic","kit","lit","xic","vil","xrit","tshh","qix","qlit","zix","\'","!")
+3 -3
View File
@@ -1635,13 +1635,13 @@
holder2.icon_state = "hudxeno"
else if(foundVirus)
holder.icon_state = "hudill"
else if(has_brain_worms())
var/mob/living/simple_animal/borer/B = has_brain_worms()
/* else if(has_brain_worms())
var/mob/living/simple_animal/borer/B = has_brain_worms() //Cotrical borer disable
if(B.controlling)
holder.icon_state = "hudbrainworm"
else
holder.icon_state = "hudhealthy"
holder2.icon_state = "hudbrainworm"
holder2.icon_state = "hudbrainworm" */
else
holder.icon_state = "hudhealthy"
if(virus2.len)
@@ -52,13 +52,13 @@
//Account for massive pressure differences
if(bodytemperature < (T0C + 5)) // start calculating temperature damage etc
if(bodytemperature < hurt_temperature) // start calculating temperature damage etc
if(bodytemperature <= (T0C - 50)) // hurt temperature
if(bodytemperature <= 50) // sqrting negative numbers is bad
if(bodytemperature <= die_temperature)
if(bodytemperature <= 50)
adjustToxLoss(200)
else
adjustToxLoss(round(sqrt(bodytemperature)) * 2)
adjustToxLoss(30)
updatehealth()
@@ -234,7 +234,7 @@
if(issilicon(L) && (rabid || attacked)) // They can't eat silicons, but they can glomp them in defence
targets += L // Possible target found!
if(istype(L, /mob/living/carbon/human) && dna) //Ignore slime(wo)men
if(istype(L, /mob/living/carbon/human)) //Ignore slime(wo)men
var/mob/living/carbon/human/H = L
if(H.species.name == "Slime")
continue
@@ -48,6 +48,8 @@
var/Atkcool = 0 // attack cooldown
var/SStun = 0 // NPC stun variable. Used to calm them down when they are attacked while feeding, or they will immediately re-attach
var/Discipline = 0 // if a slime has been hit with a freeze gun, or wrestled/attacked off a human, they become disciplined and don't attack anymore for a while. The part about freeze gun is a lie
var/hurt_temperature = T0C-50 // slime keeps taking damage when its bodytemperature is below this
var/die_temperature = 50 // slime dies instantly when its bodytemperature is below this
///////////TIME FOR SUBSPECIES
@@ -126,7 +126,7 @@
src << "They are no longer in range!"
return
/*
/mob/living/simple_animal/borer/verb/devour_brain()
set category = "Abilities"
set name = "Devour Brain"
@@ -150,7 +150,7 @@
src << "<span class = 'danger'>It only takes a few moments to render the dead host brain down into a nutrient-rich slurry...</span>"
replace_brain()
*/
// BRAIN WORM ZOMBIES AAAAH.
/mob/living/simple_animal/borer/proc/replace_brain()
+2 -2
View File
@@ -41,7 +41,7 @@
output += "<p><a href='byond://?src=\ref[src];observe=1'>Observe</A></p>"
if(!IsGuestKey(src.key))
establish_db_connection()
establish_db_connection(dbcon)
if(dbcon.IsConnected())
var/isadmin = 0
@@ -181,7 +181,7 @@
return
if(href_list["privacy_poll"])
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return
var/voted = 0
+6 -6
View File
@@ -1,6 +1,6 @@
/mob/new_player/proc/handle_privacy_poll()
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected())
return
var/voted = 0
@@ -47,7 +47,7 @@
var/optiontext
/mob/new_player/proc/handle_player_polling()
establish_db_connection()
establish_db_connection(dbcon)
if(dbcon.IsConnected())
var/isadmin = 0
if(src.client && src.client.holder)
@@ -81,7 +81,7 @@
/mob/new_player/proc/poll_player(var/pollid = -1)
if(pollid == -1) return
establish_db_connection()
establish_db_connection(dbcon)
if(dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM ss13_poll_question WHERE id = [pollid]")
@@ -342,7 +342,7 @@
if(!isnum(pollid) || !isnum(optionid))
return
establish_db_connection()
establish_db_connection(dbcon)
if(dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype, multiplechoiceoptions FROM ss13_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
@@ -412,7 +412,7 @@
if(!isnum(pollid) || !istext(replytext))
return
establish_db_connection()
establish_db_connection(dbcon)
if(dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM ss13_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
@@ -470,7 +470,7 @@
if(!isnum(pollid) || !isnum(optionid))
return
establish_db_connection()
establish_db_connection(dbcon)
if(dbcon.IsConnected())
var/DBQuery/select_query = dbcon.NewQuery("SELECT starttime, endtime, question, polltype FROM ss13_poll_question WHERE id = [pollid] AND Now() BETWEEN starttime AND endtime")
@@ -1,18 +1,18 @@
/obj/item/weapon/gun/energy/temperature
name = "temperature gun"
name = "freeze ray"
icon_state = "freezegun"
fire_sound = 'sound/weapons/pulse3.ogg'
desc = "A gun that changes temperatures. It has a small label on the side, 'More extreme temperatures will cost more charge!'"
var/temperature = T20C
var/current_temperature = T20C
charge_cost = 100
desc = "For when somebody won't let it go."
//var/temperature = T20C
//var/current_temperature = T20C
charge_cost = 25 //20 shots, exact replica of old code (WAS 100)
origin_tech = "combat=3;materials=4;powerstorage=3;magnets=2"
slot_flags = SLOT_BELT|SLOT_BACK
projectile_type = /obj/item/projectile/temp
cell_type = /obj/item/weapon/cell/high
cell_type = /obj/item/weapon/cell/crap //WAS High, but brought down to match energy use
/*
/obj/item/weapon/gun/energy/temperature/New()
..()
processing_objects.Add(src)
@@ -38,7 +38,7 @@
user << browse(dat, "window=freezegun;size=450x300;can_resize=1;can_close=1;can_minimize=1")
onclose(user, "window=freezegun", src)
*/
/obj/item/weapon/gun/energy/temperature/Topic(href, href_list)
if (..())
@@ -47,7 +47,7 @@
src.add_fingerprint(usr)
/*
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
if(amount > 0)
@@ -77,3 +77,4 @@
temperature += 10
else
temperature = current_temperature
*/
@@ -28,7 +28,7 @@
name ="high-ex round"
icon_state= "bolter"
damage = 15
on_hit(var/atom/target, var/blocked = 0)
explosion(target, -1, 0, 2)
sleep(0)
@@ -44,13 +44,13 @@
damage_type = BURN
nodamage = 1
check_armour = "energy"
var/temperature = 300
//var/temperature = 300
on_hit(var/atom/target, var/blocked = 0)//These two could likely check temp protection on the mob
if(istype(target, /mob/living))
var/mob/M = target
M.bodytemperature = temperature
M.bodytemperature = -273
return 1
/obj/item/projectile/meteor
+1 -1
View File
@@ -297,7 +297,7 @@ var/obj/machinery/blackbox_recorder/blackbox
if(!feedback) return
round_end_data_gathering() //round_end time logging and some other data processing
establish_db_connection()
establish_db_connection(dbcon)
if(!dbcon.IsConnected()) return
var/round_id
@@ -0,0 +1,96 @@
/*
* Contains general purpose procs used with Aurora's web interface and related functions.
*/
/*
* /proc/validate_webint_attributes()
* Used to validate parametres sent to procs that are meant to communicate with the web interface.
* Most commonly in Topic() calls, so that href tomfoolery is negated.
*
* Arguments:
* - var/list/required_attributes - A list of required attributes. This is what the other arguments will be tested against. Cannot be null.
* - var/list/attributes_list - The attributes to be validated, passed in a list form. Can be null.
* - var/attributes_text - The attributes to be validated, passed in a text form. (Formatted according to list2params() convention.)
* This overrides attributes_list if both are present. Can be null.
*
* Returns:
* 1 - if all required attributes are present, and no erronious ones exist.
* 0 - if certain required attributes are missing, or there are extras.
*/
/proc/webint_validate_attributes(var/list/required_attributes, var/list/attributes_list, var/attributes_text)
if (!required_attributes || !istype(required_attributes) || !required_attributes.len)
return 0
if (attributes_text)
attributes_list = params2list(attributes_text)
if (!attributes_list || !attributes_list.len)
return 0
for (var/attribute in attributes_list)
if (!(attribute in required_attributes))
return 0
if (attributes_list[attribute] && required_attributes[attribute])
if (istype(required_attributes, /list))
if (!(attributes_list[attribute] in required_attributes[attribute]))
return 0
else
if (attributes_list[attribute] != required_attributes[attribute])
return 0
return 1
/*
* /proc/webint_start_singlesignon()
* Used to insert a token into the web_sso database and to enable a user to navigate to a page on the website and be automatically logged in. Hashes the user's save file for a unique token. Additional security managed on the website's end.
*
* Arguments:
* - var/user - Must be a mob or a client. The player object that's going to be using the request.
* - var/list/attributes - The attributes to which we route the URL as we call user.process_webint_link().
* Validated here with webint_validate_attributes().
* Must contain the 'location' key.
*
* Returns:
* 0 - if one of the checks is failed and the operation cancelled.
* string - if everything works, it will return the attributes with the added token and ckey value.
*/
/proc/webint_start_singlesignon(var/client/user, var/attributes)
if (!istype(user))
return 0
var/list/permitted_locations = list("user_dashboard", "contract_overview", "contract_details")
if (!webint_validate_attributes(list("location" = permitted_locations, "contract"), attributes_text = attributes))
return 0
var/token = ""
var/list/alphabet = alphabet_uppercase
alphabet.Add(list("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"))
alphabet.Add(list("1", "2", "3", "4", "5", "6", "7", "8", "9", "0"))
for (var/i = 0, i <= 24, i++)
token += alphabet[rand(1, alphabet.len)]
attributes += "&"
attributes += list2params(list("ckey" = user.ckey, "token" = token))
establish_db_connection(dbcon)
if (!dbcon.IsConnected())
alert("An error occured while attempting to connect to the database!")
return 0
var/DBQuery/insert_query = dbcon.NewQuery("INSERT INTO ss13_web_sso (ckey, token, ip, created_at) VALUES (:ckey, :token, :ip, NOW())")
insert_query.Execute(list(":ckey" = user.ckey, ":token" = token, ":ip" = user.address))
if (insert_query.ErrorMsg())
alert("An error occured while trying to upload the session data!")
return 0
if (alert("This will take you to the webpage and log you in. Do you wish to proceed?",,"Yes","No") == "No")
return 0
return attributes