diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-02-13 10:52:26 -0500 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-02-13 10:52:26 -0500 |
commit | 4ad5d55ecf65fb1c9f58211b37f8f111e9ca0c7b (patch) | |
tree | b1ccd94f9114696d07de76f87e0c0627dd0a9f6c /actions | |
parent | 47c5d508b36d4351f2bd94e7b36738fdf040b0aa (diff) |
Add events for filtering and logging new notices
Diffstat (limited to 'actions')
-rw-r--r-- | actions/newnotice.php | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php index 5e7691f33..9face9644 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -98,7 +98,12 @@ class NewnoticeAction extends Action return; } - $this->saveNewNotice(); + try { + $this->saveNewNotice(); + } catch (Exception $e) { + $this->showForm($e->getMessage()); + return; + } } else { $this->showForm(); } @@ -123,15 +128,13 @@ class NewnoticeAction extends Action $content = $this->trimmed('status_textarea'); if (!$content) { - $this->showForm(_('No content!')); - return; + $this->clientError(_('No content!')); } else { $content_shortened = common_shorten_links($content); if (mb_strlen($content_shortened) > 140) { - $this->showForm(_('That\'s too long. '. - 'Max notice size is 140 chars.')); - return; + $this->clientError(_('That\'s too long. '. + 'Max notice size is 140 chars.')); } } @@ -154,7 +157,7 @@ class NewnoticeAction extends Action ($replyto == 'false') ? null : $replyto); if (is_string($notice)) { - $this->showForm($notice); + $this->clientError($notice); return; } |