Commit b1be2a1f authored by Dries's avatar Dries
Browse files

- Fixed a small glitch in node_preview() which made adding PHP pages rather
  annoying.
parent 4205799b
...@@ -61,7 +61,6 @@ function node_search($keys) { ...@@ -61,7 +61,6 @@ function node_search($keys) {
function node_conf_options() { function node_conf_options() {
$output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page.")); $output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page."));
$output .= form_select(t("Minimum number of words in teaser"), "minimum_teaser_size", variable_get("minimum_teaser_size", 0), array(0 => "0 words", 10 => "10 words", 25 => "25 words", 50 => "50 words", 75 => "75 words", 100 => "100 words", 125 => "125 words", 150 => "150 words", 175 => "175 words", 200 => "200 words"), t("The minimum number of words a teaser should consist of. This can be useful to rule out submissions that do not meet the site's standards, such as short test post."));
return $output; return $output;
} }
...@@ -519,14 +518,6 @@ function node_validate($node, &$error) { ...@@ -519,14 +518,6 @@ function node_validate($node, &$error) {
$error["date"] = "<div style=\"color: red;\">". t("You have to specifiy a valid date.") ."</div>"; $error["date"] = "<div style=\"color: red;\">". t("You have to specifiy a valid date.") ."</div>";
} }
/*
** Validate the "teaser"-field:
*/
if ($node->teaser && count(explode(" ", $node->teaser)) < variable_get("minimum_teaser_size", 0)) {
$error["teaser"] = "<div style=\"color: red;\">". t("Your teaser is too short.") ."</div>";
}
} }
return $node; return $node;
...@@ -652,7 +643,7 @@ function node_add($type) { ...@@ -652,7 +643,7 @@ function node_add($type) {
global $user; global $user;
/* /*
** If a node type has been specified, validate it existence. If no ** If a node type has been specified, validate it existence. If no
** (valid) node type has been provied, display a node type overview. ** (valid) node type has been provied, display a node type overview.
*/ */
...@@ -732,7 +723,11 @@ function node_preview($edit) { ...@@ -732,7 +723,11 @@ function node_preview($edit) {
*/ */
foreach ($edit as $key => $value) { foreach ($edit as $key => $value) {
$node->$key = check_input($value); $node->$key = check_output($value);
/*
** NOTE: we can't do a check_query() or check_input() here as they
** add slashes which results in breakage.
*/
} }
/* /*
......
...@@ -61,7 +61,6 @@ function node_search($keys) { ...@@ -61,7 +61,6 @@ function node_search($keys) {
function node_conf_options() { function node_conf_options() {
$output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page.")); $output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page."));
$output .= form_select(t("Minimum number of words in teaser"), "minimum_teaser_size", variable_get("minimum_teaser_size", 0), array(0 => "0 words", 10 => "10 words", 25 => "25 words", 50 => "50 words", 75 => "75 words", 100 => "100 words", 125 => "125 words", 150 => "150 words", 175 => "175 words", 200 => "200 words"), t("The minimum number of words a teaser should consist of. This can be useful to rule out submissions that do not meet the site's standards, such as short test post."));
return $output; return $output;
} }
...@@ -519,14 +518,6 @@ function node_validate($node, &$error) { ...@@ -519,14 +518,6 @@ function node_validate($node, &$error) {
$error["date"] = "<div style=\"color: red;\">". t("You have to specifiy a valid date.") ."</div>"; $error["date"] = "<div style=\"color: red;\">". t("You have to specifiy a valid date.") ."</div>";
} }
/*
** Validate the "teaser"-field:
*/
if ($node->teaser && count(explode(" ", $node->teaser)) < variable_get("minimum_teaser_size", 0)) {
$error["teaser"] = "<div style=\"color: red;\">". t("Your teaser is too short.") ."</div>";
}
} }
return $node; return $node;
...@@ -652,7 +643,7 @@ function node_add($type) { ...@@ -652,7 +643,7 @@ function node_add($type) {
global $user; global $user;
/* /*
** If a node type has been specified, validate it existence. If no ** If a node type has been specified, validate it existence. If no
** (valid) node type has been provied, display a node type overview. ** (valid) node type has been provied, display a node type overview.
*/ */
...@@ -732,7 +723,11 @@ function node_preview($edit) { ...@@ -732,7 +723,11 @@ function node_preview($edit) {
*/ */
foreach ($edit as $key => $value) { foreach ($edit as $key => $value) {
$node->$key = check_input($value); $node->$key = check_output($value);
/*
** NOTE: we can't do a check_query() or check_input() here as they
** add slashes which results in breakage.
*/
} }
/* /*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment