/** * Delete spam posts */ public function deleteAction($id) { $auth = $this->auth->getAuth(); if (!$auth) { $this->flashSession->error('You must be logged first'); return $this->indexRedirect(); } $parameters = ["id = ?0 AND (usersId = ?1 OR 'Y' = ?2 OR 'Y' = ?3)", "bind" => [$id, $auth['id'], $auth['moderator'], $auth['admin']]]; if (!($object = PostsReply::findFirst($parameters))) { $this->flashSession->error(t('Post doesn\'t exist.')); return $this->indexRedirect(); } if (!$object->delete()) { $this->saveLoger($object->getMessages()); } $this->flashSession->success(t('Data was successfully deleted')); return $this->currentRedirect(); }