1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- if (!defined('GNUSOCIAL')) { exit(1); }
- 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))) {
-
- $this->clientError(_('Cannot delete this notice.'));
- }
- $this->formOpts['notice'] = $this->notice;
- }
- function getInstructions()
- {
-
- return _('You are about to permanently delete a notice. ' .
- 'Once this is done, it cannot be undone.');
- }
- function title()
- {
-
- 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);
- }
- }
|