Пример #1
0
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #2
0
 public function save_vote($fields, $user)
 {
     $_fields = array();
     $_fields['hostname'] = filter_var($user['hostname'], FILTER_VALIDATE_IP);
     $_fields['aid'] = (int) $fields['aid'];
     if ($_fields['hostname'] == false || !M_PollAnswers::Instance()->check_answer($_fields['aid'])) {
         return false;
     }
     if ($uid = (int) $user['uid']) {
         $_fields['user_id'] = $user['uid'];
     }
     return $this->db->Insert('poll_vote', $_fields);
 }