summaryrefslogtreecommitdiff
path: root/modules/blog
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2003-09-20 16:08:57 +0000
committerDries Buytaert <dries@buytaert.net>2003-09-20 16:08:57 +0000
commit7eb33053b2a7347b82539d0f3abc20e845ba819d (patch)
tree54f62bfb75b679e35455d0103aba152431395c70 /modules/blog
parentdcbab232d61223e4b4143615f3d2560478477c07 (diff)
downloadbrdo-7eb33053b2a7347b82539d0f3abc20e845ba819d.tar.gz
brdo-7eb33053b2a7347b82539d0f3abc20e845ba819d.tar.bz2
- Updated the blog module to use the _validate hook. Fixes bug #2920 reported
by Jonathan.
Diffstat (limited to 'modules/blog')
-rw-r--r--modules/blog/blog.module33
1 files changed, 19 insertions, 14 deletions
diff --git a/modules/blog/blog.module b/modules/blog/blog.module
index 852d1c58e..e66460334 100644
--- a/modules/blog/blog.module
+++ b/modules/blog/blog.module
@@ -155,17 +155,30 @@ function blog_page_last() {
print "<div style=\"text-align: right;\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" alt=\"\" title=\"\" />", "blog/feed", array("title" => t("Read the XML version of all blogs."))) ."</div>";
}
+function blog_validate(&$node) {
+
+ /*
+ ** Validate the size of the blog:
+ */
+
+ if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_blog_size", 0)) {
+ $error["body"] = theme("theme_error", t("The body of your blog is too short."));
+ }
+
+ return $error;
+}
+
function blog_form(&$node, &$help, &$error) {
global $nid;
$iid = $_GET["iid"];
- if (empty($node->body)) {
- /*
- ** Carry out some explanation or submission guidelines:
- */
+ /*
+ ** Carry out some explanation or submission guidelines:
+ */
- $help = variable_get("blog_help", "");
+ $help = variable_get("blog_help", "");
+ if (empty($node->body)) {
/*
** If the user clicked a "blog it" link, we load the data from the
** database and quote it in the blog:
@@ -180,19 +193,11 @@ function blog_form(&$node, &$help, &$error) {
$node->body = "<a href=\"$item->link\">$item->title</a> - <i>". check_output($item->description) ."</i> [<a href=\"$item->flink\">$item->ftitle</a>]\n";
}
}
- else {
- /*
- ** Validate the size of the blog:
- */
-
- if (count(explode(" ", $node->body)) < variable_get("minimum_blog_size", 0)) {
- $error["body"] = theme("theme_error", t("The body of your blog is too short."));
- }
- }
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("blog", $node));
}
+
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
return $output;