Commit e7e104e8 authored by Dries's avatar Dries
Browse files

- 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.
parent 0222ee66
...@@ -170,7 +170,9 @@ function node_save($node, $filter) { ...@@ -170,7 +170,9 @@ function node_save($node, $filter) {
foreach ($node as $key => $value) { foreach ($node as $key => $value) {
if (in_array($key, $fields)) { if (in_array($key, $fields)) {
$k[] = check_query($key); $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) { ...@@ -192,7 +194,9 @@ function node_save($node, $filter) {
// prepare the query: // prepare the query:
foreach ($node as $key => $value) { foreach ($node as $key => $value) {
if (in_array($key, $fields)) { 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
} }
} }
......
...@@ -90,7 +90,7 @@ function node_filter_link($text) { ...@@ -90,7 +90,7 @@ function node_filter_link($text) {
function node_filter($text) { function node_filter($text) {
if (variable_get("filter_html", 0)) $text = node_filter_html($text); if (variable_get("filter_html", 0)) $text = node_filter_html($text);
if (variable_get("filter_link", 0)) $text = node_filter_link($text); if (variable_get("filter_link", 0)) $text = node_filter_link($text);
return $text; return trim($text);
} }
function node_link($type, $node = 0) { function node_link($type, $node = 0) {
...@@ -671,11 +671,19 @@ function node_preview($edit) { ...@@ -671,11 +671,19 @@ function node_preview($edit) {
$edit["created"] = time(); $edit["created"] = time();
} }
/*
** Apply the required filters:
*/
foreach ($edit as $key => $value) {
$node->$key = check_input($value);
}
/* /*
** Display a preview of the node: ** Display a preview of the node:
*/ */
node_view($edit); node_view($node);
return node_form($edit); return node_form($edit);
} }
......
...@@ -90,7 +90,7 @@ function node_filter_link($text) { ...@@ -90,7 +90,7 @@ function node_filter_link($text) {
function node_filter($text) { function node_filter($text) {
if (variable_get("filter_html", 0)) $text = node_filter_html($text); if (variable_get("filter_html", 0)) $text = node_filter_html($text);
if (variable_get("filter_link", 0)) $text = node_filter_link($text); if (variable_get("filter_link", 0)) $text = node_filter_link($text);
return $text; return trim($text);
} }
function node_link($type, $node = 0) { function node_link($type, $node = 0) {
...@@ -671,11 +671,19 @@ function node_preview($edit) { ...@@ -671,11 +671,19 @@ function node_preview($edit) {
$edit["created"] = time(); $edit["created"] = time();
} }
/*
** Apply the required filters:
*/
foreach ($edit as $key => $value) {
$node->$key = check_input($value);
}
/* /*
** Display a preview of the node: ** Display a preview of the node:
*/ */
node_view($edit); node_view($node);
return node_form($edit); return node_form($edit);
} }
......
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