. * * @category Personal * @package StatusNet * @author Evan Prodromou * @author Sarven Capadisli * @copyright 2008 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ if (!defined('GNUSOCIAL')) { exit(1); } // @todo FIXME: documentation needed. class DeletenoticeAction extends FormAction { protected $notice = null; protected function doPreparation() { $this->notice = Notice::getByID($this->trimmed('notice')); if ($this->notice->isVerb([ActivityVerb::DELETE]) || (!$this->scoped->sameAs($this->notice->getProfile()) && !$this->scoped->hasRight(Right::DELETEOTHERSNOTICE))) { // TRANS: Error message displayed when trying to delete a notice that was not made by the current user. $this->clientError(_('Cannot delete this notice.')); } $this->formOpts['notice'] = $this->notice; } function getInstructions() { // TRANS: Instructions for deleting a notice. return _('You are about to permanently delete a notice. ' . 'Once this is done, it cannot be undone.'); } function title() { // TRANS: Page title when deleting a notice. return _('Delete notice'); } protected function doPost() { if ($this->arg('yes')) { if (Event::handle('StartDeleteOwnNotice', array($this->scoped->getUser(), $this->notice))) { $this->notice->deleteAs($this->scoped); Event::handle('EndDeleteOwnNotice', array($this->scoped->getUser(), $this->notice)); } } common_redirect(common_get_returnto(), 303); } }