summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2005-02-04 20:14:05 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2005-02-04 20:14:05 +0000
commit7fe195a07e94c474a4fc97e482b06c70e4526cb0 (patch)
treea5151bf2c9098b61b9d9b25b12c4289af49b8002
parentab816b6d6d0e15d0d7f703b46e255e172d28fdea (diff)
downloadbrdo-7fe195a07e94c474a4fc97e482b06c70e4526cb0.tar.gz
brdo-7fe195a07e94c474a4fc97e482b06c70e4526cb0.tar.bz2
- PHP5 fix due object references: node previewing should not put node output into form.
-rw-r--r--includes/common.inc11
-rw-r--r--modules/node.module10
-rw-r--r--modules/node/node.module10
3 files changed, 23 insertions, 8 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 3fb7e0207..79a56dd86 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1837,6 +1837,17 @@ function drupal_get_path($type, $name) {
return dirname(drupal_get_filename($type, $name));
}
+/**
+ * Provide a substitute clone() function for PHP4.
+ */
+if (version_compare(phpversion(), '5.0') < 0) {
+ eval('
+ function clone($object) {
+ return $object;
+ }
+ ');
+}
+
include_once 'includes/theme.inc';
include_once 'includes/pager.inc';
include_once 'includes/menu.inc';
diff --git a/modules/node.module b/modules/node.module
index dc82cef05..03b33ea9e 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -815,7 +815,7 @@ function node_admin_nodes() {
}
// Regular filters
$filters = array(
- 'status' => array('title' => t('status'),
+ 'status' => array('title' => t('status'),
'options' => array('status-1' => t('published'), 'status-0' => t('not published'),
'moderate-1' => t('in moderation'), 'moderate-0' => t('not in moderation'),
'promote-1' => t('promoted'), 'promote-0' => t('not promoted'),
@@ -1493,16 +1493,18 @@ function node_preview($node) {
$node->teaser = node_teaser($node->body);
}
+ // Previewing alters $node so it needs to be cloned.
+ $edit = clone($node);
// Display a preview of the node:
if ($node->teaser && $node->teaser != $node->body) {
$output = '<h3>'. t('Preview trimmed version') .'</h3>';
- $output .= node_view($node, 1, FALSE, 0);
+ $output .= node_view($edit, 1, FALSE, 0);
$output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
$output .= '<h3>'. t('Preview full version') .'</h3>';
- $output .= node_view($node, 0, FALSE, 0);
+ $output .= node_view($edit, 0, FALSE, 0);
}
else {
- $output .= node_view($node, 0, FALSE, 0);
+ $output .= node_view($edit, 0, FALSE, 0);
}
$output .= node_form($node);
diff --git a/modules/node/node.module b/modules/node/node.module
index dc82cef05..03b33ea9e 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -815,7 +815,7 @@ function node_admin_nodes() {
}
// Regular filters
$filters = array(
- 'status' => array('title' => t('status'),
+ 'status' => array('title' => t('status'),
'options' => array('status-1' => t('published'), 'status-0' => t('not published'),
'moderate-1' => t('in moderation'), 'moderate-0' => t('not in moderation'),
'promote-1' => t('promoted'), 'promote-0' => t('not promoted'),
@@ -1493,16 +1493,18 @@ function node_preview($node) {
$node->teaser = node_teaser($node->body);
}
+ // Previewing alters $node so it needs to be cloned.
+ $edit = clone($node);
// Display a preview of the node:
if ($node->teaser && $node->teaser != $node->body) {
$output = '<h3>'. t('Preview trimmed version') .'</h3>';
- $output .= node_view($node, 1, FALSE, 0);
+ $output .= node_view($edit, 1, FALSE, 0);
$output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
$output .= '<h3>'. t('Preview full version') .'</h3>';
- $output .= node_view($node, 0, FALSE, 0);
+ $output .= node_view($edit, 0, FALSE, 0);
}
else {
- $output .= node_view($node, 0, FALSE, 0);
+ $output .= node_view($edit, 0, FALSE, 0);
}
$output .= node_form($node);