=== modified file 'includes/common.inc' --- includes/common.inc 2007-03-08 19:33:55 +0000 +++ includes/common.inc 2007-03-25 19:39:50 +0000 @@ -351,6 +351,7 @@ function drupal_not_found() { if (empty($return)) { drupal_set_title(t('Page not found')); + $return = ''; } // To conserve CPU and bandwidth, omit the blocks print theme('page', $return, FALSE); @@ -898,6 +899,7 @@ function format_rss_item($title, $link, * with the same format as $array itself for nesting. */ function format_xml_elements($array) { + $output = ''; foreach ($array as $key => $value) { if (is_numeric($key)) { if ($value['key']) { === modified file 'includes/menu.inc' --- includes/menu.inc 2007-03-19 01:13:28 +0000 +++ includes/menu.inc 2007-03-25 16:05:26 +0000 @@ -635,7 +635,8 @@ function menu_rebuild() { $item = &$menu[$path]; $number_parts = $item['_number_parts']; if (isset($item['parent'])) { - $parent_parts = explode('/', $menu_path_map[$item['parent']], 6); + $item['parent'] = $menu_path_map[$item['parent']]; + $parent_parts = explode('/', $item['parent'], 6); $slashes = count($parent_parts) - 1; } else { @@ -726,7 +727,7 @@ function menu_rebuild() { $item['parent'] = implode('/', array_slice($item['_parts'], 0, $item['_number_parts'] - 1)); } else { - $item['_depth'] = $item['parent'] ? $menu[$menu_path_map[$item['parent']]]['_depth'] + 1 : 1; + $item['_depth'] = $item['parent'] ? $menu[$item['parent']]['_depth'] + 1 : 1; } } else { === modified file 'includes/session.inc' --- includes/session.inc 2006-12-04 10:41:19 +0000 +++ includes/session.inc 2007-03-25 19:22:39 +0000 @@ -70,11 +70,11 @@ function sess_write($key, $value) { // session table rows without breaking throttle module and "Who's Online" // block. if ($user->uid || $value || count($_COOKIE)) { - db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, $user->cache, $_SERVER["REMOTE_ADDR"], $value, time()); + db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, isset($user->cache) ? $user->cache : '', $_SERVER["REMOTE_ADDR"], $value, time()); } } else { - db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, $user->cache, $_SERVER["REMOTE_ADDR"], $value, time(), $key); + db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, isset($user->cache) ? $user->cache : '', $_SERVER["REMOTE_ADDR"], $value, time(), $key); // TODO: this can be an expensive query. Perhaps only execute it every x minutes. Requires investigation into cache expiration. if ($user->uid) { === modified file 'includes/theme.inc' --- includes/theme.inc 2007-03-02 09:40:13 +0000 +++ includes/theme.inc 2007-03-25 19:21:15 +0000 @@ -810,6 +810,9 @@ function theme_table($header, $rows, $at } $output .= " \n"; } + else { + $ts = array(); + } // Format the table rows: $output .= "
\n"; === modified file 'install.php' --- install.php 2007-03-05 16:15:22 +0000 +++ install.php 2007-03-25 05:15:40 +0000 @@ -547,6 +547,7 @@ function install_missing_modules_error($ */ function install_complete($profile) { global $base_url; + $output = ''; // Store install profile for later use. variable_set('install_profile', $profile); === modified file 'modules/blog/blog.module' --- modules/blog/blog.module 2007-03-07 12:41:02 +0000 +++ modules/blog/blog.module 2007-03-25 19:33:59 +0000 @@ -133,7 +133,7 @@ function blog_page_user($uid) { $account = user_load(array((is_numeric($uid) ? 'uid' : 'name') => $uid, 'status' => 1)); - if ($account->uid) { + if (!empty($account->uid)) { drupal_set_title($title = t("@name's blog", array('@name' => $account->name))); if (($account->uid == $user->uid) && user_access('edit own blog')) { === modified file 'modules/comment/comment.module' --- modules/comment/comment.module 2007-03-12 13:08:02 +0000 +++ modules/comment/comment.module 2007-03-25 19:24:30 +0000 @@ -1538,7 +1538,23 @@ function comment_form($edit, $title = NU $form['subject'] = array('#type' => 'textfield', '#title' => t('Subject'), '#maxlength' => 64, '#default_value' => !empty($edit['subject']) ? $edit['subject'] : ''); } - $form['comment_filter']['comment'] = array('#type' => 'textarea', '#title' => t('Comment'), '#rows' => 15, '#default_value' => !empty($edit['comment']) ? $edit['comment'] : $user->signature, '#required' => TRUE); + if (!empty($edit['comment'])) { + $default = $edit['comment']; + } + elseif (isset($user->signature)) { + $default = $user->signature; + } + else { + $default = ''; + } + + $form['comment_filter']['comment'] = array( + '#type' => 'textarea', + '#title' => t('Comment'), + '#rows' => 15, + '#default_value' => $default, + '#required' => TRUE, + ); if (!isset($edit['format'])) { $edit['format'] = FILTER_FORMAT_DEFAULT; } === modified file 'modules/contact/contact.module' --- modules/contact/contact.module 2007-02-15 11:40:17 +0000 +++ modules/contact/contact.module 2007-03-25 19:27:33 +0000 @@ -98,7 +98,15 @@ function contact_menu() { function _contact_user_tab_access($account) { global $user; - return $account && (($user->uid != $account->uid && $account->contact) || user_access('administer users')); + if (!isset($account->contact)) { + $account->contact = FALSE; + } + return + $account && + ( + ($user->uid != $account->uid && $account->contact) || + user_access('administer users') + ); } /** === modified file 'modules/node/content_types.inc' --- modules/node/content_types.inc 2007-03-07 13:08:04 +0000 +++ modules/node/content_types.inc 2007-03-25 19:07:31 +0000 @@ -20,24 +20,20 @@ function node_overview_types() { if (function_exists($type->module .'_form')) { $name = check_plain($name); $type_url_str = str_replace('_', '-', $type->type); - // Populate the operations field. - $operations = array(); - + $row = array( + l($name, 'admin/content/types/'. $type_url_str), + check_plain($type->type), + check_plain($type->description), + ); // Set the edit column. - $operations[] = array('data' => l(t('edit'), 'admin/content/types/'. $type_url_str)); + $row[] = array('data' => l(t('edit'), 'admin/content/types/'. $type_url_str)); // Set the delete column. if ($type->custom) { - $operations[] = array('data' => l(t('delete'), 'admin/content/types/'. $type_url_str .'/delete')); + $row[] = array('data' => l(t('delete'), 'admin/content/types/'. $type_url_str .'/delete')); } else { - $operations[] = array('data' => ''); - } - - $row = array(array('data' => l($name, 'admin/content/types/'. $type_url_str), 'class' => $class), array('data' => check_plain($type->type), 'class' => $class), array('data' => check_plain($type->description), 'class' => $class)); - foreach ($operations as $operation) { - $operation['class'] = $class; - $row[] = $operation; + $row[] = array('data' => ''); } $rows[] = $row; } === modified file 'modules/node/node.module' --- modules/node/node.module 2007-03-17 18:30:14 +0000 +++ modules/node/node.module 2007-03-25 19:37:35 +0000 @@ -290,6 +290,15 @@ function node_type_save($info) { $is_existing = FALSE; $existing_type = !empty($info->old_type) ? $info->old_type : $info->type; $is_existing = db_num_rows(db_query("SELECT * FROM {node_type} WHERE type = '%s'", $existing_type)); + if (!isset($info->help)) { + $info->help = ''; + } + if (!isset($info->min_word_count)) { + $info->min_word_count = 0; + } + if (!isset($info->body_label)) { + $info->body_label = ''; + } if ($is_existing) { db_query("UPDATE {node_type} SET type = '%s', name = '%s', module = '%s', has_title = %d, title_label = '%s', has_body = %d, body_label = '%s', description = '%s', help = '%s', min_word_count = %d, custom = %d, modified = %d, locked = %d WHERE type = '%s'", $info->type, $info->name, $info->module, $info->has_title, $info->title_label, $info->has_body, $info->body_label, $info->description, $info->help, $info->min_word_count, $info->custom, $info->modified, $info->locked, $existing_type); @@ -1760,6 +1769,7 @@ function node_feed($nodes = 0, $channel $item_length = variable_get('feed_item_length', 'teaser'); $namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"'); + $items = ''; while ($node = db_fetch_object($nodes)) { // Load the specified node: $item = node_load($node->nid); @@ -1784,7 +1794,7 @@ function node_feed($nodes = 0, $channel $extra = node_invoke_nodeapi($item, 'rss item'); $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => date('r', $item->created)), array('key' => 'dc:creator', 'value' => $item->name), array('key' => 'guid', 'value' => $item->nid .' at '. $base_url, 'attributes' => array('isPermaLink' => 'false')))); foreach ($extra as $element) { - if ($element['namespace']) { + if (isset($element['namespace'])) { $namespaces = array_merge($namespaces, $element['namespace']); } } @@ -1938,6 +1948,10 @@ function node_form($node, $form_values = foreach (array('nid', 'vid', 'uid', 'created', 'type') as $key) { $form[$key] = array('#type' => 'value', '#value' => isset($node->$key) ? $node->$key : NULL); } + if (!isset($node->nid)) { + $node->body = NULL; + $node->title = NULL; + } // Changed must be sent to the client, for later overwrite error checking. $form['changed'] = array('#type' => 'hidden', '#default_value' => isset($node->changed) ? $node->changed : NULL); === modified file 'modules/system/system.module' --- modules/system/system.module 2007-03-17 18:30:14 +0000 +++ modules/system/system.module 2007-03-25 19:11:28 +0000 @@ -457,6 +457,7 @@ function system_admin_theme_submit($form */ function system_theme_select_form($description = '', $default_value = '', $weight = 0) { if (user_access('select different theme')) { + $enabled = array(); foreach (list_themes() as $theme) { if ($theme->status) { $enabled[] = $theme; @@ -975,7 +976,7 @@ function system_theme_data() { db_query("DELETE FROM {system} WHERE type = 'theme'"); foreach ($themes as $theme) { - db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, 'theme', $theme->filename, $theme->status, 0, 0); + db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0); } return $themes; @@ -1142,6 +1143,7 @@ function system_themes() { drupal_clear_css_cache(); $themes = system_theme_data(); ksort($themes); + $status = array(); foreach ($themes as $info) { $info->screenshot = dirname($info->filename) .'/screenshot.png'; @@ -1150,10 +1152,10 @@ function system_themes() { $form[$info->name]['screenshot'] = array('#value' => $screenshot); $form[$info->name]['description'] = array('#type' => 'item', '#title' => $info->name, '#value' => dirname($info->filename)); $options[$info->name] = ''; - if ($info->status) { + if (!empty($info->status)) { $status[] = $info->name; } - if ($info->status && (function_exists($info->prefix .'_settings') || function_exists($info->prefix .'_features'))) { + if (!empty($info->status) && (function_exists($info->prefix .'_settings') || function_exists($info->prefix .'_features'))) { $form[$info->name]['operations'] = array('#value' => l(t('configure'), 'admin/build/themes/settings/'. $info->name) ); } else { @@ -1325,8 +1327,9 @@ function system_modules($form_values = N } } + $modules_required = drupal_required_modules(); // Merge in required modules. - foreach (drupal_required_modules() as $required) { + foreach ($modules_required as $required) { $disabled[] = $required; $form['disabled_modules']['#value'][$required] = TRUE; } @@ -1498,7 +1501,7 @@ function system_modules_submit($form_id, $current_module_list = module_list(TRUE, FALSE); - if (is_array($form_values['throttle'])) { + if (isset($form_values['throttle'])) { foreach ($form_values['throttle'] as $key => $choice) { db_query("UPDATE {system} SET throttle = %d WHERE type = 'module' and name = '%s'", $choice ? 1 : 0, $key); } @@ -1853,7 +1856,13 @@ function system_status($check = FALSE) { * Helper function to sort requirements. */ function _system_sort_requirements($a, $b) { - return (isset($a['weight']) || isset($b['weight'])) ? $a['weight'] - $b['weight'] : strcmp($a['title'], $b['title']); + if (!isset($a['weight'])) { + if (!isset($b['weight'])) { + return strcmp($a['title'], $b['title']); + } + return -$b['weight']; + } + return isset($b['weight']) ? $a['weight'] - $b['weight'] : $a['weight']; } /** @@ -2199,6 +2208,9 @@ function theme_admin_page($blocks) { // perform automatic striping. $block['position'] = ++$stripe % 2 ? 'left' : 'right'; } + if (!isset($container[$block['position']])) { + $container[$block['position']] = ''; + } $container[$block['position']] .= $block_output; } } === modified file 'modules/taxonomy/taxonomy.module' --- modules/taxonomy/taxonomy.module 2007-03-25 19:06:53 +0000 +++ modules/taxonomy/taxonomy.module 2007-03-25 20:12:12 +0000 @@ -179,7 +179,7 @@ function taxonomy_overview_terms($vocabu $header = array(t('Name'), t('Operations')); drupal_set_title(check_plain($vocabulary->name)); - $start_from = $_GET['page'] ? $_GET['page'] : 0; + $start_from = isset($_GET['page']) ? $_GET['page'] : 0; $total_entries = 0; // total count for pager $page_increment = 25; // number of tids per page $displayed_count = 0; // number of tids shown @@ -194,7 +194,7 @@ function taxonomy_overview_terms($vocabu $displayed_count++; // we're counting tids displayed } - if (!$rows) { + if (empty($rows)) { $rows[] = array(array('data' => t('No terms available.'), 'colspan' => '2')); } @@ -212,6 +212,18 @@ function taxonomy_overview_terms($vocabu * Display form for adding and editing vocabularies. */ function taxonomy_form_vocabulary($edit = array()) { + $edit += array( + 'name' => '', + 'description' => '', + 'help' => '', + 'nodes' => array(), + 'hierarchy' => 0, + 'relations' => 0, + 'tags' => 0, + 'multiple' => 0, + 'required' => 0, + 'weight' => 0, + ); $form['name'] = array('#type' => 'textfield', '#title' => t('Vocabulary name'), '#default_value' => $edit['name'], @@ -270,7 +282,7 @@ function taxonomy_form_vocabulary($edit ); $form['submit'] = array('#type' => 'submit', '#value' => t('Submit')); - if ($edit['vid']) { + if (isset($edit['vid'])) { $form['delete'] = array('#type' => 'submit', '#value' => t('Delete')); $form['vid'] = array('#type' => 'value', '#value' => $edit['vid']); $form['module'] = array('#type' => 'value', '#value' => $edit['module']); @@ -372,6 +384,12 @@ function taxonomy_vocabulary_confirm_del } function taxonomy_form_term($vocabulary, $edit = array()) { + $edit += array( + 'name' => '', + 'description' => '', + 'tid' => NULL, + 'weight' => 0, + ); $form['name'] = array( '#type' => 'textfield', '#title' => t('Term name'), @@ -397,10 +415,10 @@ function taxonomy_form_term($vocabulary, $exclude[] = $edit['tid']; if ($vocabulary->hierarchy == 1) { - $form['parent'] = _taxonomy_term_select(t('Parent'), 'parent', $parent, $vocabulary_id, l(t('Parent term'), 'admin/help/taxonomy', array('fragment' => 'parent')) .'.', 0, '<'. t('root') .'>', $exclude); + $form['parent'] = _taxonomy_term_select(t('Parent'), 'parent', $parent, $vocabulary->vid, l(t('Parent term'), 'admin/help/taxonomy', array('fragment' => 'parent')) .'.', 0, '<'. t('root') .'>', $exclude); } elseif ($vocabulary->hierarchy == 2) { - $form['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary_id, l(t('Parent terms'), 'admin/help/taxonomy', array('fragment' => 'parent')) .'.', 1, '<'. t('root') .'>', $exclude); + $form['parent'] = _taxonomy_term_select(t('Parents'), 'parent', $parent, $vocabulary->vid, l(t('Parent terms'), 'admin/help/taxonomy', array('fragment' => 'parent')) .'.', 1, '<'. t('root') .'>', $exclude); } } @@ -463,12 +481,12 @@ function taxonomy_form_term_submit($form * Status constant indicating if term was inserted or updated. */ function taxonomy_save_term(&$form_values) { - if ($form_values['tid'] && $form_values['name']) { + if (!empty($form_values['tid']) && $form_values['name']) { db_query("UPDATE {term_data} SET name = '%s', description = '%s', weight = %d WHERE tid = %d", $form_values['name'], $form_values['description'], $form_values['weight'], $form_values['tid']); $hook = 'update'; $status = SAVED_UPDATED; } - else if ($form_values['tid']) { + else if (!empty($form_values['tid'])) { return taxonomy_del_term($form_values['tid']); } else { @@ -479,7 +497,7 @@ function taxonomy_save_term(&$form_value } db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $form_values['tid'], $form_values['tid']); - if ($form_values['relations']) { + if (!empty($form_values['relations'])) { foreach ($form_values['relations'] as $related_id) { if ($related_id != 0) { db_query('INSERT INTO {term_relation} (tid1, tid2) VALUES (%d, %d)', $form_values['tid'], $related_id); @@ -760,9 +778,9 @@ function taxonomy_node_get_terms($node, * Make sure incoming vids are free tagging enabled. */ function taxonomy_node_validate(&$node) { - if ($node->taxonomy) { + if (!empty($node->taxonomy)) { $terms = $node->taxonomy; - if ($terms['tags']) { + if (!empty($terms['tags'])) { foreach ($terms['tags'] as $vid => $vid_value) { $vocabulary = taxonomy_vocabulary_load($vid); if (empty($vocabulary->tags)) { @@ -1279,11 +1297,15 @@ function taxonomy_nodeapi($node, $op, $a return $output; case 'insert': - taxonomy_node_save($node, $node->taxonomy); + if (!empty($node->taxonomy)) { + taxonomy_node_save($node, $node->taxonomy); + } break; case 'update': - taxonomy_node_save($node, $node->taxonomy); + if (!empty($node->taxonomy)) { + taxonomy_node_save($node, $node->taxonomy); + } break; case 'delete': === modified file 'modules/user/user.module' --- modules/user/user.module 2007-03-24 05:36:30 +0000 +++ modules/user/user.module 2007-03-25 06:19:31 +0000 @@ -111,7 +111,7 @@ function user_load($array = array()) { function user_save($account, $array = array(), $category = 'account') { // Dynamically compose a SQL query: $user_fields = user_fields(); - if ($account->uid) { + if (is_object($account) && $account->uid) { user_module_invoke('update', $array, $account, $category); $query = ''; $data = unserialize(db_result(db_query('SELECT data FROM {users} WHERE uid = %d', $account->uid))); @@ -1281,12 +1281,11 @@ function user_register() { // Remove form_group around default fields if there are no other groups. if (!$extra) { - $form['name'] = $form['account']['name']; - $form['mail'] = $form['account']['mail']; - $form['pass'] = $form['account']['pass']; - $form['status'] = $form['account']['status']; - $form['roles'] = $form['account']['roles']; - $form['notify'] = $form['account']['notify']; + foreach (array('name', 'mail', 'pass', 'status', 'roles', 'notify') as $key) { + if (isset($form['account'][$key])) { + $form[$key] = $form['account'][$key]; + } + } unset($form['account']); } else { @@ -1313,11 +1312,14 @@ function user_register_submit($form_id, else { $pass = user_password(); }; - $notify = $form_values['notify']; + $notify = isset($form_values['notify']) ? $form_values['notify'] : NULL; $from = variable_get('site_mail', ini_get('sendmail_from')); if (isset($form_values['roles'])) { $roles = array_filter($form_values['roles']); // Remove unset roles } + else { + $roles = array(); + } if (!$admin && array_intersect(array_keys($form_values), array('uid', 'roles', 'init', 'session', 'status'))) { watchdog('security', t('Detected malicious attempt to alter protected user fields.'), WATCHDOG_WARNING); === modified file 'profiles/default/default.profile' --- profiles/default/default.profile 2007-02-04 21:20:50 +0000 +++ profiles/default/default.profile 2007-03-25 05:25:08 +0000 @@ -42,6 +42,8 @@ function default_profile_final() { 'custom' => TRUE, 'modified' => TRUE, 'locked' => FALSE, + 'help' => '', + 'min_word_count' => '', ), array( 'type' => 'story', @@ -51,6 +53,8 @@ function default_profile_final() { 'custom' => TRUE, 'modified' => TRUE, 'locked' => FALSE, + 'help' => '', + 'min_word_count' => '', ), ); === modified file 'themes/engines/phptemplate/phptemplate.engine' --- themes/engines/phptemplate/phptemplate.engine 2007-03-25 19:18:12 +0000 +++ themes/engines/phptemplate/phptemplate.engine 2007-03-25 20:10:04 +0000 @@ -202,15 +202,15 @@ function phptemplate_page($content, $sho 'head_title' => implode(' | ', $head_title), 'help' => theme('help'), 'language' => $GLOBALS['locale'], - 'layout' => $layout, + 'layout' => isset($layout) ? $layout : NULL, 'logo' => theme_get_setting('logo'), 'messages' => theme('status_messages'), 'mission' => isset($mission) ? $mission : '', 'primary_links' => menu_primary_links(), 'search_box' => (theme_get_setting('toggle_search') ? drupal_get_form('search_theme_form') : ''), 'secondary_links' => menu_secondary_links(), - 'sidebar_left' => $sidebar_left, - 'sidebar_right' => $sidebar_right, + 'sidebar_left' => !empty($sidebar_left) ? $sidebar_left : '', + 'sidebar_right' => !empty($sidebar_right) ? $sidebar_right : '', 'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''), 'site_slogan' => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''), 'css' => drupal_add_css(), @@ -261,9 +261,18 @@ function phptemplate_node($node, $teaser else { $taxonomy = array(); } + if ($teaser && $node->teaser) { + $content = $node->teaser; + } + elseif (isset($node->body)) { + $content = $node->body; + } + else { + $content = ''; + } $variables = array( - 'content' => ($teaser && $node->teaser) ? $node->teaser : $node->body, + 'content' => $content, 'date' => format_date($node->created), 'links' => $node->links ? theme('links', $node->links, array('class' => 'links inline')) : '', 'name' => theme('username', $node),