示例#1
0
 /**
  * Delete post
  */
 public function deletePost($post_id)
 {
     $post_wall_data = $this->getPostsWallProfileData($post_id);
     // check if my post or on my wall
     if ($this->getPostAuthorId($post_id) != Zend_Auth::getInstance()->getIdentity()->id && $post_wall_data['owner'] != Zend_Auth::getInstance()->getIdentity()->id && $this->getPostWallId($post_id) != Zend_Auth::getInstance()->getIdentity()->id && Zend_Auth::getInstance()->getIdentity()->role !== 'admin' && Zend_Auth::getInstance()->getIdentity()->role !== 'reviewer') {
         return false;
     }
     // delete post's images
     $Images = new Application_Model_Images();
     $Images->deletePostImages($post_id);
     // delete post's meta data
     $PostsMeta = new Application_Model_PostsMeta();
     $PostsMeta->metaRemove($post_id);
     // delete connected comments, likes and reports
     $this->deleteConnectedResourcesData('post', $post_id);
     // delete post and return
     return $this->delete(array('id = ?' => $post_id));
 }