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

4.6.x
Steven Wittens 2005-02-04 20:14:05 +00:00
parent ab816b6d6d
commit 7fe195a07e
3 changed files with 23 additions and 8 deletions

View File

@ -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';

View File

@ -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);

View File

@ -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);