Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.662 diff -u -F^f -r1.662 node.module --- modules/node/node.module 26 Jul 2006 08:25:25 -0000 1.662 +++ modules/node/node.module 27 Jul 2006 20:02:37 -0000 @@ -515,21 +515,9 @@ function node_view($node, $teaser = FALS // Remove the delimiter (if any) that separates the teaser from the body. // TODO: this strips legitimate uses of '' also. $node->body = str_replace('', '', $node->body); + + $node->content = node_build_content($node, $teaser, $page); - if ($node->log != '' && !$teaser) { - $node->body .= '
'. t('Log') .':
'. filter_xss($node->log) .'
'; - } - - // The 'view' hook can be implemented to overwrite the default function - // to display nodes. - if (node_hook($node, 'view')) { - node_invoke($node, 'view', $teaser, $page); - } - else { - $node = node_prepare($node, $teaser); - } - // Allow modules to change $node->body before viewing. - node_invoke_nodeapi($node, 'view', $teaser, $page); if ($links) { $node->links = module_invoke_all('link', 'node', $node, !$page); @@ -538,11 +526,14 @@ function node_view($node, $teaser = FALS $function($node, $node->links); } } + // unset unused $node part so that a bad theme can not open a security hole if ($teaser) { + $node->teaser = form_render($node->content); unset($node->body); } else { + $node->body = form_render($node->content); unset($node->teaser); } @@ -553,14 +544,51 @@ function node_view($node, $teaser = FALS * Apply filters to a node in preparation for theming. */ function node_prepare($node, $teaser = FALSE) { - $node->readmore = (strlen($node->teaser) < strlen($node->body)); - if ($teaser == FALSE) { - $node->body = check_markup($node->body, $node->format, FALSE); + $contents = array(); + + $contents['body'] = array( + '#type' => 'markup', + '#value' => $teaser ? check_markup($node->teaser, $node->format, FALSE) : check_markup($node->body, $node->format, FALSE), + '#weight' => 0, + ); + + + if (strlen($node->teaser) < strlen($node->body)) { + $contents['#readmore'] = TRUE; + } + + return $contents; +} + +function node_build_content($node, $teaser, $page) { + $content = array(); + + if ($node->log != '' && !$teaser) { + $content['core']['log_message'] = array( + '#type' => 'markup', + '#value' => theme('node_log_message', filter_xss($node->log)), + '#weight' => 1, + ); + } + + // The 'view' hook can be implemented to overwrite the default function + // to display nodes. + if (node_hook($node, 'view')) { + $content = node_invoke($node, 'view', $teaser, $page); } else { - $node->teaser = check_markup($node->teaser, $node->format, FALSE); + $content = node_prepare($node, $teaser); } - return $node; + + // Allow modules to make their own additions to the content array. + $content = array_merge($content, node_invoke_nodeapi($node, 'view', $teaser, $page)); + + foreach (module_implements('node_content_alter') AS $module) { + $function = $module .'_node_content_alter'; + $function($node, $content); + } + + return $content; } /** Index: modules/upload/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v retrieving revision 1.113 diff -u -F^f -r1.113 upload.module --- modules/upload/upload.module 19 Jul 2006 07:15:35 -0000 1.113 +++ modules/upload/upload.module 27 Jul 2006 20:02:37 -0000 @@ -449,7 +449,12 @@ function upload_nodeapi(&$node, $op, $te // Add the attachments list to node body if (count($node->files) && !$teaser) { - $node->body .= theme('upload_attachments', $node->files); + $content['files'] = array( + '#type' => 'upload_attachments', + '#value' => $node->files, + '#weight' => 20, + ); + return $content; } } break; @@ -505,7 +510,7 @@ function upload_nodeapi(&$node, $op, $te function theme_upload_attachments($files) { $header = array(t('Attachment'), t('Size')); $rows = array(); - foreach ($files as $file) { + foreach ($files['#value'] as $file) { if ($file->list) { $href = check_url(($file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path())))); $text = check_plain($file->description ? $file->description : $file->filename); Index: sites/default/settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/settings.php,v retrieving revision 1.31 diff -u -F^f -r1.31 settings.php --- sites/default/settings.php 14 Jul 2006 02:21:52 -0000 1.31 +++ sites/default/settings.php 27 Jul 2006 20:02:37 -0000 @@ -84,7 +84,7 @@ * $db_url = 'mysqli://username:password@localhost/databasename'; * $db_url = 'pgsql://username:password@localhost/databasename'; */ -$db_url = 'mysql://username:password@localhost/databasename'; +$db_url = 'mysql://bonsai_tree:leafy@localhost/bonsai_test'; $db_prefix = ''; /**