Commit on behalf of Willox

Fixes an exploit with voting

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3760 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
quartz235@gmail.com
2012-06-07 18:49:43 +00:00
parent df57c88166
commit 65c0028b63

View File

@@ -174,7 +174,7 @@
var/text = "<HTML><HEAD><TITLE>Voting</TITLE></HEAD><BODY scroll=no>"
var/footer = "<HR><A href='?src=\ref[vote];voter=\ref[src];vclose=1'>Close</A></BODY></HTML>"
var/footer = "<HR><A href='?src=\ref[vote];vclose=1'>Close</A></BODY></HTML>"
if(config.vote_no_dead && usr.stat == 2)
@@ -207,7 +207,7 @@
if(src.client.vote == md)
text += "<LI><B>[disp]</B>"
else
text += "<LI><A href='?src=\ref[vote];voter=\ref[src];vote=[md]'>[disp]</A>"
text += "<LI><A href='?src=\ref[vote];vote=[md]'>[disp]</A>"
text += "[votes[md]>0?" - [votes[md]] vote\s":null]<BR>"
@@ -231,7 +231,7 @@
if(src.client.vote == md)
text += "<LI><B>[disp]</B>"
else
text += "<LI><A href='?src=\ref[vote];voter=\ref[src];vote=[md]'>[disp]</A>"
text += "<LI><A href='?src=\ref[vote];vote=[md]'>[disp]</A>"
text += "[votes[md]>0?" - [votes[md]] vote\s":null]<BR>"
@@ -268,9 +268,9 @@
else // voting can begin
if(config.allow_vote_restart)
text += "<A href='?src=\ref[vote];voter=\ref[src];vmode=1'>Begin restart vote.</A><BR>"
text += "<A href='?src=\ref[vote];vmode=1'>Begin restart vote.</A><BR>"
if(config.allow_vote_mode)
text += "<A href='?src=\ref[vote];voter=\ref[src];vmode=2'>Begin change mode vote.</A><BR>"
text += "<A href='?src=\ref[vote];vmode=2'>Begin change mode vote.</A><BR>"
text += footer
usr << browse(text, "window=vote")
@@ -286,14 +286,17 @@
/datum/vote/Topic(href, href_list)
..()
//world << "[usr] has activated the vote Topic"
var/mob/M = locate(href_list["voter"]) // mob of player that clicked link
if(href_list["voter"])
world << "[usr.ckey] has attempted to bypass the voting system." //ckey is easy key
return
if(href_list["vclose"])
if(M)
M << browse(null, "window=vote")
M.client.showvote = 0
if(usr)
usr << browse(null, "window=vote")
usr.client.showvote = 0
return
if(href_list["vmode"])
@@ -314,10 +317,10 @@
spawn(config.vote_period*10)
vote.endvote()
world << "\red<B>*** A vote to [vote.mode?"change game mode":"restart"] has been initiated by [M.key].</B>"
world << "\red<B>*** A vote to [vote.mode?"change game mode":"restart"] has been initiated by [usr.key].</B>"
world << "\red You have [vote.timetext(config.vote_period)] to vote."
log_vote("Voting to [vote.mode ? "change mode" : "restart round"] started by [M.name]/[M.key]")
log_vote("Voting to [vote.mode ? "change mode" : "restart round"] started by [usr.name]/[usr.key]")
for(var/mob/CM in world)
if(CM.client)
@@ -326,17 +329,17 @@
else
CM.client.vote = "default"
if(M) M.vote()
if(usr) usr.vote()
return
return
if(href_list["vote"] && vote.voting)
if(M)
M.client.vote = href_list["vote"]
if(usr)
usr.client.vote = href_list["vote"]
//world << "Setting client [M.key]'s vote to: [href_list["vote"]]."
//world << "Setting client [usr.key]'s vote to: [href_list["vote"]]."
M.vote()
usr.vote()
return