1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-11-22 14:04:33 +01:00

IP: Unique_ip is working!

+ Fix a ugly bug

TODO: Some style
This commit is contained in:
Tagadda 2018-08-14 21:08:02 +02:00
parent a6e986fb16
commit 24f385d12d

View File

@ -50,7 +50,7 @@ class Poll
$poll->options = $saved_poll_data->options; $poll->options = $saved_poll_data->options;
$poll->delete_token = $saved_poll_data->delete_token; $poll->delete_token = $saved_poll_data->delete_token;
$poll->settings = $saved_poll_data->settings; $poll->settings = $saved_poll_data->settings;
$poll->ips = $saved_poll_data->ips; $poll->ips = (array) $saved_poll_data->ips;
dba_close($db); dba_close($db);
return $poll; return $poll;
@ -92,12 +92,12 @@ class Poll
*/ */
public function vote(array $options) public function vote(array $options)
{ {
if($this->settings['unique_ip'] === true) if($this->settings->unique_ip === false)
{ {
if(isset($this->ips[Flight::request()->query["ip"]])) if(isset($this->ips[Flight::request()->ip]))
return false; return false;
else else
$this->ips["test"] = true; $this->ips[Flight::request()->ip] = true;
} }
// For each option in the list, add 1 to the vote number in the poll data. // For each option in the list, add 1 to the vote number in the poll data.