diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-11-01 22:54:16 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-11-01 22:54:16 +0000 |
commit | 4d8b485fad960ea6551111e58f8c59df053b4456 (patch) | |
tree | 51c7738a0ee2d4ac3e63552643de52bab1c41da5 /modules/blog/blog.module | |
parent | e205fee081d307ee7a3ef2248fbb3ded7fcf003c (diff) | |
download | brdo-4d8b485fad960ea6551111e58f8c59df053b4456.tar.gz brdo-4d8b485fad960ea6551111e58f8c59df053b4456.tar.bz2 |
- Added error handling support to the <node>_form hook.
Diffstat (limited to 'modules/blog/blog.module')
-rw-r--r-- | modules/blog/blog.module | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/blog/blog.module b/modules/blog/blog.module index a0489928b..397fb56cf 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -178,20 +178,25 @@ function blog_page_last() { $theme->box(t("User blogs"), $output, "main"); } -function blog_form($edit) { +function blog_form($node, $error) { global $nid, $iid; - if (!$edit->body) { + if ($node->body) { + if (count(explode(" ", $node->body)) < variable_get("minimum_node_size", 0)) { + $error["body"] = "<div style=\"color: red;\">". t("The body of your blog is too short.") ."</div>"; + } + } + else { if ($nid && $blog = node_load(array("nid" => $nid))) { - $edit->body = "<i>". $blog->body ."</i> [<a href=\"module.php?mod=blog&id=$blog->uid&date=$blog->created\">$blog->name</a>]"; + $node->body = "<i>". $blog->body ."</i> [<a href=\"module.php?mod=blog&id=$blog->uid&date=$blog->created\">$blog->name</a>]"; } if ($iid && $item = db_fetch_object(db_query("SELECT i.*, f.title as ftitle, f.link as flink FROM item i, feed f WHERE i.iid = '". check_input($iid) ."' AND i.fid = f.fid"))) { - $edit->body = "<a href=\"$item->link\">$item->title</a> - <i>". check_output($item->description) ."</i> [<a href=\"$item->flink\">$item->ftitle</a>]\n"; + $node->body = "<a href=\"$item->link\">$item->title</a> - <i>". check_output($item->description) ."</i> [<a href=\"$item->flink\">$item->ftitle</a>]\n"; } } - $output = form_textarea(t("Body"), "body", $edit->body, 60, 15, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); + $output = form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); return $output; } |