示例#1
0
 /**
  * Update single comment
  */
 public function updateComment($comment_id, $content)
 {
     $user_role = Zend_Auth::getInstance()->getIdentity()->role;
     // check if my comment or an admin
     if ($this->getCommentAuthorId($comment_id) != Zend_Auth::getInstance()->getIdentity()->id && ($user_role != 'admin' && $user_role != 'reviewer')) {
         return false;
     }
     $content = Application_Plugin_Common::limitInput($content);
     $data = array('content' => $content);
     $where = $this->getAdapter()->quoteInto('id = ?', $comment_id);
     $rows_updated = $this->update($data, $where);
     return $rows_updated == 1 ? true : false;
 }
示例#2
0
 /**
  * Update single post row
  */
 public function updatePost($post_id, array $content, $privacy)
 {
     $PostsMeta = new Application_Model_PostsMeta();
     $content['content'] = Application_Plugin_Common::limitInput($content['content']);
     $data = array('content' => $content['content'], 'privacy' => $privacy);
     $where = $this->getAdapter()->quoteInto('id = ?', $post_id);
     $rows_updated = $this->update($data, $where);
     // write post's meta data
     if (isset($content['meta'])) {
         foreach ($content['meta'] as $metakey => $metavalue) {
             $PostsMeta->metaUpdate($post_id, $metakey, $metavalue);
         }
     } else {
         $PostsMeta->metaRemove($post_id);
     }
     return $rows_updated == 1 ? true : false;
 }