diff options
author | Evan Prodromou <evan@prodromou.name> | 2008-05-21 08:26:04 -0400 |
---|---|---|
committer | Evan Prodromou <evan@prodromou.name> | 2008-05-21 08:26:04 -0400 |
commit | 659feb5f43a1bd75b385fa2c96b568b71d2bcd96 (patch) | |
tree | 241ed992b20288b59e66099ff41a05b0bf0582f9 /actions/newnotice.php | |
parent | 53eeee70e7eaba81b44f35d787b218f8ebaa69e6 (diff) |
correct error-handling in newnotice
darcs-hash:20080521122604-84dde-bfcfe7b2a254f19ce56054f6e4c80317ed8aaf86.gz
Diffstat (limited to 'actions/newnotice.php')
-rw-r--r-- | actions/newnotice.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php index 6e6c3ff2c..f17ada307 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -42,6 +42,7 @@ class NewnoticeAction extends Action { } function save_new_notice() { + $user = common_current_user(); assert($user); # XXX: maybe an error instead... $notice = DB_DataObject::factory('notice'); @@ -53,13 +54,15 @@ class NewnoticeAction extends Action { if (!$notice->content) { $this->show_form(_t('No content!')); + return; } else if (strlen($notice->content) > 140) { $this->show_form(_t('Notice content too long.')); + return; } - + return $notice->insert(); } - + function show_form($msg=NULL) { common_show_header(_t('New notice')); if ($msg) { |