/** * Set data in a comment object and returns errors if data doesn't fit * * @access private */ private function check_data() { if (!VPost::respond_name()) { $this->_errors['name'] = true; } else { $this->_comment->_name = VPost::respond_name(); } if (!VPost::respond_email() || !preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+\$/", VPost::respond_email())) { $this->_errors['email'] = true; } else { $this->_comment->_email = VPost::respond_email(); } if (!VPost::respond_content()) { $this->_errors['content'] = true; } else { $this->_comment->_content = VPost::respond_content(); } if (!VPost::number() || md5(VPost::number()) != VPost::result()) { $this->_errors['question'] = true; } if (!empty($this->_errors['name']) || !empty($this->_errors['email']) || !empty($this->_errors['content']) || !empty($this->_errors['question'])) { return false; } else { return true; } }