Exemple #1
0
 public function onVoteGuest($ip, array $chosen)
 {
     $pid = $this->getID();
     $eip = self::escape($ip);
     $choices = implode(':', $chosen);
     if (false !== ($row = GWF_VoteMultiRow::getVoteRowGuest($pid, $ip))) {
         if (false === $this->onRevert($row)) {
             return false;
         }
         if (false === GDO::table('GWF_VoteMultiRow')->update("vmr_choices='{$choices}'", "vmr_vmid={$pid} AND vmr_ip='{$eip}'")) {
             return false;
         }
         if (false === $this->onApply($chosen)) {
             return false;
         }
     } else {
         $row = new GWF_VoteMultiRow(array('vmr_vmid' => $pid, 'vmr_uid' => 0, 'vmr_ip' => $ip, 'vmr_time' => time(), 'vmr_choices' => $choices));
         if (false === $row->insert()) {
             return false;
         }
         if (false === $this->onApply($chosen)) {
             return false;
         }
     }
     return true;
 }