Пример #1
0
 /**
  * @param $commentOnPageEntities
  * @param $commentOnPageEntity
  * @param $i
  */
 private static function _setComment($commentOnPageEntities, $commentOnPageEntity, $i)
 {
     $parentIds = $commentOnPageEntity->parentIds;
     if (count($parentIds) > $i) {
         if ($commentOnPageEntities[$parentIds[$i]]->id == $commentOnPageEntity->parentId) {
             $commentOnPageEntities[$parentIds[$i]]->childCommentsOnPage[$commentOnPageEntity->id] = $commentOnPageEntity;
         } else {
             CommentOnPageDAO::_setComment($commentOnPageEntities[$parentIds[$i]]->childCommentsOnPage, $commentOnPageEntity, $i + 1);
         }
     }
 }
Пример #2
0
 /**
  * POST: /main/delete-comment
  */
 public function deleteCommentPost()
 {
     $commentId = $_REQUEST['CommentId'];
     $commentOnPageDAO = new CommentOnPageDAO();
     $comment = $commentOnPageDAO->getCommentOnPage($commentId);
     if (Authentication::isAuthenticated() && (Authentication::getUserEntity()->id == $comment->userId || Authentication::hasRoles(array('manager', 'admin')))) {
         $commentOnPageDAO->delete($commentId);
         echo 'success';
     }
 }