diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-09-20 16:03:05 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-09-20 16:03:05 +0000 |
commit | dcbab232d61223e4b4143615f3d2560478477c07 (patch) | |
tree | 930e3cf277d11198f0ae227773d3d5a29db0eb35 | |
parent | 00a62647bc7af43e15de61cd47801b475be4bd9c (diff) | |
download | brdo-dcbab232d61223e4b4143615f3d2560478477c07.tar.gz brdo-dcbab232d61223e4b4143615f3d2560478477c07.tar.bz2 |
- Updated the story module to use the _validate hook. Fixes bug #2919 reported
by Jonathan.
-rw-r--r-- | modules/story.module | 32 | ||||
-rw-r--r-- | modules/story/story.module | 32 |
2 files changed, 32 insertions, 32 deletions
diff --git a/modules/story.module b/modules/story.module index 3357e27c4..f58fa4381 100644 --- a/modules/story.module +++ b/modules/story.module @@ -61,32 +61,32 @@ function story_link($type) { return $links; } -function story_form(&$node, &$help, &$error) { - - if (isset($node->body)) { +function story_validate(&$node) { - /* - ** Validate the size of the story: - */ - - if (count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { - $error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>"; - } + /* + ** Validate the size of the story: + */ + if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { +print "body : $node->body"; + $error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>"; } - else { - /* - ** Carry out some explanation or submission guidelines: - */ + return $error; +} + +function story_form(&$node, &$help, &$error) { - $help = variable_get("story_help", ""); + /* + ** Carry out some explanation or submission guidelines: + */ - } + $help = variable_get("story_help", ""); if (function_exists("taxonomy_node_form")) { $output .= implode("", taxonomy_node_form("story", $node)); } + $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text()); return $output; diff --git a/modules/story/story.module b/modules/story/story.module index 3357e27c4..f58fa4381 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -61,32 +61,32 @@ function story_link($type) { return $links; } -function story_form(&$node, &$help, &$error) { - - if (isset($node->body)) { +function story_validate(&$node) { - /* - ** Validate the size of the story: - */ - - if (count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { - $error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>"; - } + /* + ** Validate the size of the story: + */ + if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) { +print "body : $node->body"; + $error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>"; } - else { - /* - ** Carry out some explanation or submission guidelines: - */ + return $error; +} + +function story_form(&$node, &$help, &$error) { - $help = variable_get("story_help", ""); + /* + ** Carry out some explanation or submission guidelines: + */ - } + $help = variable_get("story_help", ""); if (function_exists("taxonomy_node_form")) { $output .= implode("", taxonomy_node_form("story", $node)); } + $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text()); return $output; |