コード例 #1
0
ファイル: postModel.php プロジェクト: Althona/MyFace
 /**
  * @param postID string
  * @param userName string
  * @return bool
  * check if the logged in user is admin.
  * if not the user cannot delete other users comments
  */
 public function deletePost($postID, $userName)
 {
     if (is_numeric($postID) && is_string($userName)) {
         if ($userName == self::$admin) {
             return $this->postDAL->adminDeletePost($postID, $userName);
         } else {
             return $this->postDAL->deletePost($postID, $userName);
         }
     }
     return false;
 }
コード例 #2
0
ファイル: postController.php プロジェクト: Althona/MyFace
 /**
  * @param loginUser string
  * chekc if user wants to edit and delete
  */
 public function postController($loginUser)
 {
     if ($this->classPostView->triedToEditPost()) {
         if ($this->checkEditPost()) {
             if ($this->classPostModel->updatePost(trim($this->classPostView->getEditComment()), $this->classPostView->getEditButton(), $loginUser)) {
                 $this->classFrontPageView->setMessage(\frontPageView\FrontPageView::EDIT_POST_SUCCESS);
             }
         }
     }
     if ($this->classPostView->triedToDeletePost()) {
         if ($this->classPostModel->deletePost($this->classPostView->getPostID(), $loginUser)) {
             $this->classFrontPageView->setMessage(\frontPageView\FrontPageView::DELETE_POST_SUCCESS);
         }
     }
 }
コード例 #3
0
 public function delete()
 {
     $iId = $this->httpRequest->post('id');
     $iProfileId = $this->session->get('member_id');
     CommentCoreModel::deleteRecipient($iId, 'Note');
     $this->oNoteModel->deleteCategory($iId);
     $this->_deleteThumbFile($iId, $iProfileId);
     $this->oNoteModel->deletePost($iId, $iProfileId);
     /* Clean NoteModel Cache */
     (new Framework\Cache\Cache())->start(NoteModel::CACHE_GROUP, null, null)->clear();
     Header::redirect(Uri::get('note', 'main', 'index'), t('Your post was deleted!'));
 }