Commit 7fe195a0 authored by Steven Wittens's avatar Steven Wittens
Browse files

- PHP5 fix due object references: node previewing should not put node output into form.

parent ab816b6d
......@@ -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';
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
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