From 3f5ededc01d8eedac2a9a75917849fbe78a3e701 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 20 May 2008 15:10:32 -0400 Subject: call validate before saving objects darcs-hash:20080520191032-84dde-64197121c93cd4cf3cbc614badff0bd44547f9f9.gz --- actions/newnotice.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'actions/newnotice.php') diff --git a/actions/newnotice.php b/actions/newnotice.php index fed3278a4..5bbc91531 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -49,7 +49,14 @@ class NewnoticeAction extends Action { $notice->profile_id = $user->id; # user id *is* profile id $notice->created = DB_DataObject_Cast::dateTime(); $notice->content = trim($this->arg('content')); - return $notice->insert(); + + $val = $notice->validate(); + if ($val === TRUE) { + return $notice->insert(); + } else { + // XXX: display some info + return NULL; + } } function show_form() { -- cgit v1.2.3-54-g00ecf