From e7e104e82f3def8136c91337a19ce0cc3e451f64 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 18 Nov 2001 13:21:35 +0000 Subject: [PATCH] - node system: + Made the filters work again! + There is one strange thing that I can't track down though: for some reason, "^M" characters (?) are padded after newline ("\n" and / or "\r") characters. --- includes/node.inc | 8 ++++++-- modules/node.module | 12 ++++++++++-- modules/node/node.module | 12 ++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/includes/node.inc b/includes/node.inc index e3c04db988b..a020cb724c9 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -170,7 +170,9 @@ function node_save($node, $filter) { foreach ($node as $key => $value) { if (in_array($key, $fields)) { $k[] = check_query($key); - $v[] = "'". check_query($value) ."'"; + $v[] = "'". check_input($value) ."'"; + // NOTE: for the values we use 'check_input()' such that we apply + // the filters } } @@ -192,7 +194,9 @@ function node_save($node, $filter) { // prepare the query: foreach ($node as $key => $value) { if (in_array($key, $fields)) { - $q[] = check_query($key) ." = '". check_query($value) ."'"; + $q[] = check_query($key) ." = '". check_input($value) ."'"; + // NOTE: for the values we use 'check_input()' such that we apply + // the filters } } diff --git a/modules/node.module b/modules/node.module index f0b0a511183..ecbc2dfce47 100644 --- a/modules/node.module +++ b/modules/node.module @@ -90,7 +90,7 @@ function node_filter_link($text) { function node_filter($text) { if (variable_get("filter_html", 0)) $text = node_filter_html($text); if (variable_get("filter_link", 0)) $text = node_filter_link($text); - return $text; + return trim($text); } function node_link($type, $node = 0) { @@ -671,11 +671,19 @@ function node_preview($edit) { $edit["created"] = time(); } + /* + ** Apply the required filters: + */ + + foreach ($edit as $key => $value) { + $node->$key = check_input($value); + } + /* ** Display a preview of the node: */ - node_view($edit); + node_view($node); return node_form($edit); } diff --git a/modules/node/node.module b/modules/node/node.module index f0b0a511183..ecbc2dfce47 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -90,7 +90,7 @@ function node_filter_link($text) { function node_filter($text) { if (variable_get("filter_html", 0)) $text = node_filter_html($text); if (variable_get("filter_link", 0)) $text = node_filter_link($text); - return $text; + return trim($text); } function node_link($type, $node = 0) { @@ -671,11 +671,19 @@ function node_preview($edit) { $edit["created"] = time(); } + /* + ** Apply the required filters: + */ + + foreach ($edit as $key => $value) { + $node->$key = check_input($value); + } + /* ** Display a preview of the node: */ - node_view($edit); + node_view($node); return node_form($edit); }