From 84e2fbceb130dda0da649af40c160e608b75174f Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Tue, 17 Jul 2012 21:50:57 +0000 Subject: [PATCH] - Added a bit of code that lets you know if there are any new polls available which you haven't answered yet. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4100 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/mob/new_player/new_player.dm | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index ddd15680763..23fbb250f6c 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -48,11 +48,23 @@ output += "

Observe

" - var/DBConnection/dbcon = new() - dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]") - if(dbcon.IsConnected()) - output += "

Show Player Polls

" - dbcon.Disconnect() + if(!IsGuestKey(src.key)) + var/DBConnection/dbcon = new() + dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]") + + if(dbcon.IsConnected()) + var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_poll_question WHERE Now() BETWEEN starttime AND endtime AND id NOT IN (SELECT pollid FROM erro_poll_vote WHERE ckey = \"[ckey]\")") + query.Execute() + var/newpoll = 0 + while(query.NextRow()) + newpoll = 1 + break + + if(newpoll) + output += "

Show Player Polls (NEW!)

" + else + output += "

Show Player Polls

" + dbcon.Disconnect() output += ""