Exemplo n.º 1
0
 /**
  * Validate the website
  *
  * @return boolean
  */
 protected function _validateWebsite()
 {
     $author = $this->comment->getCommenter();
     if ($author->getWebsite() && !Zend_Uri::check($author->getWebsite())) {
         $this->errors['website']['invalid'] = 'Website is niet geldig';
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Save a comment object to the database
  *
  * @param SxCms_Comment $comment
  * @return mixed
  */
 public function save(SxCms_Comment $comment)
 {
     $db = Zend_Registry::get('db');
     $author = $comment->getCommenter();
     $data = array('page_id' => $comment->getPage()->getId(), 'comment' => $comment->getMessage(), 'datePosted' => date('Y-m-d H:i:s'), 'author_name' => $author->getName(), 'author_email' => $author->getEmail(), 'author_link' => $author->getWebsite(), 'approved' => $comment->isApproved(), 'dateApproved' => $comment->getDateApproved());
     if (!$comment->getId()) {
         $result = $db->insert('PageComment', $data);
         $comment->setId($db->lastInsertId());
         return $result;
     }
     return $db->update('PageComment', $data, 'comment_id = ' . $comment->getId());
 }