]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
correct error-handling in newnotice
authorEvan Prodromou <evan@prodromou.name>
Wed, 21 May 2008 12:26:04 +0000 (08:26 -0400)
committerEvan Prodromou <evan@prodromou.name>
Wed, 21 May 2008 12:26:04 +0000 (08:26 -0400)
darcs-hash:20080521122604-84dde-bfcfe7b2a254f19ce56054f6e4c80317ed8aaf86.gz

actions/newnotice.php

index 6e6c3ff2c2f1f80a6e688fcc115ba0990965e810..f17ada3072e49785b56abf32aeceb35825a8f59e 100644 (file)
@@ -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) {