=== modified file 'includes/bootstrap.inc'
--- includes/bootstrap.inc	2007-03-26 01:32:22 +0000
+++ includes/bootstrap.inc	2007-03-26 16:14:28 +0000
@@ -355,7 +355,9 @@ function drupal_get_filename($type, $nam
     }
   }
 
-  return $files[$type][$name];
+  if (isset($files[$type][$name])) {
+    return $files[$type][$name];
+  }
 }
 
 /**

=== modified file 'includes/common.inc'
--- includes/common.inc	2007-03-26 01:32:22 +0000
+++ includes/common.inc	2007-03-26 07:34:23 +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);
@@ -871,6 +872,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']) {
@@ -1972,7 +1974,12 @@ function drupal_mail($mailkey, $to, $sub
   // Bundle up the variables into a structured array for altering.
   $message = array('#mail_id' => $mailkey, '#to' => $to, '#subject' => $subject, '#body' => $body, '#from' => $from, '#headers' => $headers);
   drupal_alter('mail', $message);
-  list($mailkey, $to, $subject, $body, $from, $headers) = $message;
+  $mailkey = $message['#mail_id'];
+  $to = $message['#to'];
+  $subject = $message['#subject'];
+  $body = $message['#body'];
+  $from = $message['#from'];
+  $headers = $message['#headers'];
 
   // Allow for custom mail backend
   if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) {

=== modified file 'includes/file.inc'
--- includes/file.inc	2007-02-15 11:40:17 +0000
+++ includes/file.inc	2007-03-25 23:43:34 +0000
@@ -382,7 +382,7 @@ function file_copy(&$source, $dest = 0, 
     @chmod($dest, 0664);
   }
 
-  if (is_object($file)) {
+  if (isset($file) && is_object($file)) {
     $file->filename = $basename;
     $file->filepath = $dest;
     $source = $file;

=== modified file 'includes/form.inc'
--- includes/form.inc	2007-03-26 00:35:58 +0000
+++ includes/form.inc	2007-03-26 07:07:07 +0000
@@ -319,7 +319,7 @@ function drupal_prepare_form($form_id, &
       $form['form_token'] = array('#type' => 'token', '#default_value' => drupal_get_token($form['#token']));
     }
   }
-  else if ($user->uid && !$form['#programmed']) {
+  else if (isset($user->uid) && $user->uid && !$form['#programmed']) {
     $form['#token'] = $form_id;
     $form['form_token'] = array(
       '#id' => form_clean_id('edit-'. $form_id .'-form-token'),
@@ -1263,7 +1263,14 @@ function expand_radios($element) {
   if (count($element['#options']) > 0) {
     foreach ($element['#options'] as $key => $choice) {
       if (!isset($element[$key])) {
-        $element[$key] = array('#type' => 'radio', '#title' => $choice, '#return_value' => $key, '#default_value' => $element['#default_value'], '#attributes' => $element['#attributes'], '#parents' => $element['#parents'], '#spawned' => TRUE);
+        $element[$key] = array(
+          '#type' => 'radio',
+          '#title' => $choice,
+          '#return_value' => $key,
+          '#default_value' => isset($element['#default_value']) ? $element['#default_value'] : NULL,
+          '#attributes' => $element['#attributes'],
+          '#parents' => $element['#parents'],
+        );
       }
     }
   }

=== modified file 'includes/install.inc'
--- includes/install.inc	2007-02-11 08:48:36 +0000
+++ includes/install.inc	2007-03-26 07:08:51 +0000
@@ -204,7 +204,7 @@ function drupal_rewrite_settings($settin
           // Write new value to settings.php in the following format:
           //    $'setting' = 'value'; // 'comment'
           $setting = $settings[$variable[1]];
-          $buffer .= '$'. $variable[1] ." = '". $setting['value'] ."';". ($setting['comment'] ? ' // '. $setting['comment'] ."\n" : "\n");
+          $buffer .= '$'. $variable[1] ." = '". $setting['value'] ."';". (!empty($setting['comment']) ? ' // '. $setting['comment'] ."\n" : "\n");
           unset($settings[$variable[1]]);
         }
         else {

=== modified file 'includes/locale.inc'
--- includes/locale.inc	2007-03-26 01:32:22 +0000
+++ includes/locale.inc	2007-03-26 16:12:15 +0000
@@ -1301,7 +1301,7 @@ function _locale_import_parse_quoted($st
  */
 function _locale_export_po($language) {
   global $user;
-
+  $header = '';
   // Get language specific strings, or all strings
   if ($language) {
     $meta = db_fetch_object(db_query("SELECT * FROM {languages} WHERE language = '%s'", $language));

=== modified file 'includes/menu.inc'
--- includes/menu.inc	2007-03-26 00:35:58 +0000
+++ includes/menu.inc	2007-03-26 05:53:22 +0000
@@ -632,7 +632,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 {
@@ -723,7 +724,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 20:57:02 +0000
@@ -611,7 +611,7 @@ function theme_links($links, $attributes
         // Pass in $link as $options, they share the same keys.
         $output .= l($link['title'], $link['href'], $link);
       }
-      else if ($link['title']) {
+      else if (!empty($link['title'])) {
         // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
         if (empty($link['html'])) {
           $link['title'] = check_plain($link['title']);
@@ -810,6 +810,9 @@ function theme_table($header, $rows, $at
     }
     $output .= " </tr></thead>\n";
   }
+  else {
+    $ts = array();
+  }
 
   // Format the table rows:
   $output .= "<tbody>\n";

=== modified file 'modules/aggregator/aggregator.module'
--- modules/aggregator/aggregator.module	2007-03-17 18:30:14 +0000
+++ modules/aggregator/aggregator.module	2007-03-26 15:53:06 +0000
@@ -310,7 +310,7 @@ function aggregator_block($op = 'list', 
 /**
  * Generate a form to add/edit/delete aggregator categories.
  */
- function aggregator_form_category($edit = array()) {
+function aggregator_form_category($edit = array('title' => '', 'description' => '', 'cid' => NULL)) {
   $form['title'] = array('#type' => 'textfield',
     '#title' => t('Title'),
     '#default_value' => $edit['title'],
@@ -392,13 +392,13 @@ function aggregator_form_category_submit
  * Add/edit/delete aggregator categories.
  */
 function aggregator_save_category($edit) {
-  if ($edit['cid'] && $edit['title']) {
+  if (!empty($edit['cid']) && !empty($edit['title'])) {
     db_query("UPDATE {aggregator_category} SET title = '%s', description = '%s' WHERE cid = %d", $edit['title'], $edit['description'], $edit['cid']);
   }
-  else if ($edit['cid']) {
+  else if (!empty($edit['cid'])) {
     db_query('DELETE FROM {aggregator_category} WHERE cid = %d', $edit['cid']);
   }
-  else if ($edit['title']) {
+  else if (!empty($edit['title'])) {
     // A single unique id for bundles and feeds, to use in blocks
     $next_id = db_next_id('{aggregator_category}_cid');
     db_query("INSERT INTO {aggregator_category} (cid, title, description, block) VALUES (%d, '%s', '%s', 5)", $next_id, $edit['title'], $edit['description']);
@@ -408,7 +408,7 @@ function aggregator_save_category($edit)
 /**
  * Generate a form to add/edit feed sources.
  */
-function aggregator_form_feed($edit = array()) {
+function aggregator_form_feed($edit = array('refresh' => 900, 'title' => '', 'url' => '', 'fid' => NULL)) {
   $period = drupal_map_assoc(array(900, 1800, 3600, 7200, 10800, 21600, 32400, 43200, 64800, 86400, 172800, 259200, 604800, 1209600, 2419200), 'format_interval');
 
   if ($edit['refresh'] == '') {
@@ -568,7 +568,7 @@ function aggregator_remove($feed) {
   while ($item = db_fetch_object($result)) {
     $items[] = "iid = $item->iid";
   }
-  if ($items) {
+  if (!empty($items)) {
     db_query('DELETE FROM {aggregator_category_item} WHERE '. implode(' OR ', $items));
   }
   db_query('DELETE FROM {aggregator_item} WHERE fid = %d', $feed['fid']);
@@ -677,6 +677,7 @@ function aggregator_element_data($parser
       // it or its contents will end up in the item array.
       break;
     default:
+      $channel += array($tag => '');
       $channel[$tag] .= $data;
   }
 }

=== modified file 'modules/block/block.module'
--- modules/block/block.module	2007-03-25 21:11:26 +0000
+++ modules/block/block.module	2007-03-26 16:10:34 +0000
@@ -191,6 +191,10 @@ function _block_rehash() {
 
   // Reinsert new set of blocks into table.
   foreach ($blocks as $block) {
+    $block += array(
+      'visibility' => NULL,
+      'throttle' => NULL,
+    );
     db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, visibility, pages, custom, throttle, title) VALUES ('%s', '%s', '%s', %d, %d, '%s', %d, '%s', %d, %d, '%s')", $block['module'], $block['delta'], $theme_key, $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle'], $block['title']);
   }
   db_unlock_tables();
@@ -238,7 +242,7 @@ function block_admin_display($theme = NU
     );
 
     if ($throttle) {
-      $form[$i]['throttle'] = array('#type' => 'checkbox', '#default_value' => $block['throttle']);
+      $form[$i]['throttle'] = array('#type' => 'checkbox', '#default_value' => isset($block['throttle']) ? $block['throttle'] : FALSE);
     }
     $form[$i]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta']));
     if ($block['module'] == 'block') {
@@ -567,6 +571,10 @@ function block_box_delete_submit($form_i
  * Define the custom block form.
  */
 function block_box_form($edit = array()) {
+  $edit += array(
+    'info' => '',
+    'body' => '',
+  );
   $form['info'] = array(
     '#type' => 'textfield',
     '#title' => t('Block description'),

=== 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/book/book.module'
--- modules/book/book.module	2007-03-25 21:02:33 +0000
+++ modules/book/book.module	2007-03-26 07:44:49 +0000
@@ -196,14 +196,14 @@ function book_submit(&$node) {
  */
 function book_form(&$node) {
   $type = node_get_types('type', $node);
-  if ($node->nid && !$node->parent && !user_access('create new books')) {
+  if (!empty($node->nid) && !$node->parent && !user_access('create new books')) {
     $form['parent'] = array('#type' => 'value', '#value' => $node->parent);
   }
   else {
     $form['parent'] = array('#type' => 'select',
       '#title' => t('Parent'),
-      '#default_value' => ($node->parent ? $node->parent : arg(4)),
-      '#options' => book_toc($node->nid),
+      '#default_value' => (isset($node->parent) ? $node->parent : arg(4)),
+      '#options' => book_toc(isset($node->nid) ? $node->nid : 0),
       '#weight' => -4,
       '#description' => user_access('create new books') ? t('The parent section in which to place this page. Note that each page whose parent is &lt;top-level&gt; is an independent, top-level book.') : t('The parent that this page belongs in.'),
     );
@@ -226,7 +226,7 @@ function book_form(&$node) {
   if (user_access('administer nodes')) {
     $form['weight'] = array('#type' => 'weight',
       '#title' => t('Weight'),
-      '#default_value' => $node->weight,
+      '#default_value' => isset($node->weight) ? $node->weight : 0,
       '#delta' => 15,
       '#weight' => 5,
       '#description' => t('Pages at a given level are ordered first by weight and then by title.'),
@@ -251,13 +251,13 @@ function book_form(&$node) {
 function book_outline($node) {
   $form['parent'] = array('#type' => 'select',
     '#title' => t('Parent'),
-    '#default_value' => $node->parent,
+    '#default_value' => isset($node->parent) ? $node->parent : 0,
     '#options' => book_toc($node->nid),
     '#description' => t('The parent page in the book.'),
   );
   $form['weight'] = array('#type' => 'weight',
     '#title' => t('Weight'),
-    '#default_value' => $node->weight,
+    '#default_value' => isset($node->weight) ? $node->weight : 0,
     '#delta' => 15,
     '#description' => t('Pages at a given level are ordered first by weight and then by title.'),
   );
@@ -266,7 +266,7 @@ function book_outline($node) {
     '#description' => t('An explanation to help other authors understand your motivations to put this post into the book.'),
   );
 
-  $form['nid'] = array('#type' => 'value', '#value' => $nid);
+  $form['nid'] = array('#type' => 'value', '#value' => isset($node->nid) ? $node->nid : 0);
   if (isset($node->parent)) {
     $form['update'] = array('#type' => 'submit',
       '#value' => t('Update book outline'),

=== modified file 'modules/color/color.module'
--- modules/color/color.module	2007-03-26 00:35:58 +0000
+++ modules/color/color.module	2007-03-26 05:53:22 +0000
@@ -145,7 +145,7 @@ function theme_color_scheme_form($form) 
   $info = $form['info']['#value'];
   $path = drupal_get_path('theme', $theme) .'/';
   drupal_add_css($path . $info['preview_css']);
-
+  $output = '';
   // Wrapper
   $output .= '<div class="color-form clear-block">';
 

=== modified file 'modules/comment/comment.module'
--- modules/comment/comment.module	2007-03-26 00:35:58 +0000
+++ modules/comment/comment.module	2007-03-26 05:53:22 +0000
@@ -384,7 +384,7 @@ function comment_form_alter($form, $form
       '#description' => t('Users with the <em>administer comments</em> permission will be able to override this setting.'),
     );
   }
-  elseif (isset($form['type'])) {
+  elseif (isset($form['type']) && isset($form['#node'])) {
     if ($form['type']['#value'] .'_node_form' == $form_id) {
       $node = $form['#node'];
       $form['comment_settings'] = array(
@@ -1535,7 +1535,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 23:25:04 +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')
+    );
 }
 
 /**
@@ -121,7 +129,7 @@ function contact_user($type, &$edit, &$u
     return $form;
   }
   elseif ($type == 'validate') {
-    return array('contact' => $edit['contact']);
+    return array('contact' => isset($edit['contact']) ? $edit['contact'] : FALSE);
   }
   elseif ($type == 'insert') {
     $edit['contact'] = variable_get('contact_default_status', 1);
@@ -149,6 +157,16 @@ function contact_admin_edit($cid = NULL)
   if (arg(3) == "edit" && $cid > 0) {
     $edit = db_fetch_array(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid));
   }
+  else {
+    $edit = array(
+      'category' => '',
+      'recipients' => '',
+      'reply' => '',
+      'weight' => 0,
+      'selected' => 0,
+      'cid' => NULL,
+    );
+  }
   $form['category'] = array('#type' => 'textfield',
     '#title' => t('Category'),
     '#maxlength' => 255,

=== modified file 'modules/forum/forum.module'
--- modules/forum/forum.module	2007-03-26 00:35:58 +0000
+++ modules/forum/forum.module	2007-03-26 16:09:24 +0000
@@ -210,7 +210,7 @@ function forum_admin_settings() {
 function forum_form_alter(&$form, $form_id) {
   // hide critical options from forum vocabulary
   if ($form_id == 'taxonomy_form_vocabulary') {
-    if ($form['vid']['#value'] == _forum_get_vid()) {
+    if (isset($form['vid']) && $form['vid']['#value'] == _forum_get_vid()) {
       $form['help_forum_vocab'] = array(
         '#value' => t('This is the designated forum vocabulary. Some of the normal vocabulary options have been removed.'),
         '#weight' => -1,
@@ -280,14 +280,12 @@ function forum_block($op = 'list', $delt
             break;
         }
 
-        if ($content) {
+        if (!empty($content)) {
           $content .= '<div class="more-link">'. l(t('more'), 'forum', array('title' => t('Read the latest forum topics.'))) .'</div>';
+          $block['subject'] = $title;
+          $block['content'] = $content;
+          return $block;
         }
-
-        $block['subject'] = $title;
-        $block['content'] = $content;
-
-        return $block;
       }
   }
 }
@@ -439,6 +437,12 @@ function forum_delete(&$node) {
  * @param $edit Associative array containing a container term to be added or edited.
  */
 function forum_form_container($edit = array()) {
+  $edit += array(
+    'name' => '',
+    'description' => '',
+    'tid' => 0,
+    'weight' => 0,
+  );
   // Handle a delete operation.
   $form['name'] = array(
     '#title' => t('Container name'),
@@ -481,7 +485,7 @@ function forum_form_container($edit = ar
 }
 
 function forum_form_main($type, $edit = array()) {
-  if ($_POST['op'] == t('Delete') || $_POST['confirm']) {
+  if ((isset($_POST['op']) && $_POST['op'] == t('Delete')) || !empty($_POST['confirm'])) {
     return drupal_get_form('forum_confirm_delete', $edit['tid']);
   }
   switch ($type) {
@@ -500,6 +504,12 @@ function forum_form_main($type, $edit = 
  * @param $edit Associative array containing a forum term to be added or edited.
  */
 function forum_form_forum($edit = array()) {
+  $edit += array(
+    'name' => '', 
+    'description' => '', 
+    'tid' => NULL, 
+    'weight' => 0,
+  );
   $form['name'] = array('#type' => 'textfield',
     '#title' => t('Forum name'),
     '#default_value' => $edit['name'],
@@ -1077,7 +1087,7 @@ function theme_forum_topic_navigation($n
 
   // get previous and next topic
   $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 AND n.type = 'forum' ORDER BY n.sticky DESC, ". _forum_get_topic_order_sql(variable_get('forum_order', 1));
-  $result = db_query(db_rewrite_sql($sql), $node->tid);
+  $result = db_query(db_rewrite_sql($sql), isset($node->tid) ? $node->tid : 0);
 
   $stop = 0;
   while ($topic = db_fetch_object($result)) {
@@ -1097,13 +1107,13 @@ function theme_forum_topic_navigation($n
     }
   }
 
-  if ($prev || $next) {
+  if (!empty($prev) || !empty($next)) {
     $output .= '<div class="forum-topic-navigation clear-block">';
 
-    if ($prev) {
+    if (!empty($prev)) {
       $output .= l(t('‹ ') . $prev->title, 'node/'. $prev->nid, array('class' => 'topic-previous', 'title' => t('Go to previous forum topic')));
     }
-    if ($prev && $next) {
+    if (!empty($prev) && !empty($next)) {
       // Word break (a is an inline element)
       $output .= ' ';
     }

=== 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-26 07:49: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;
     }
@@ -172,7 +168,7 @@ function node_type_form($type = NULL) {
   );
   $form['orig_type'] = array(
     '#type' => 'value',
-    '#value' => $type->orig_type,
+    '#value' => isset($type->orig_type) ? $type->orig_type : '',
   );
   $form['module'] = array(
     '#type' => 'value',

=== modified file 'modules/node/node.module'
--- modules/node/node.module	2007-03-26 01:32:22 +0000
+++ modules/node/node.module	2007-03-26 16:49:23 +0000
@@ -65,7 +65,7 @@ function node_cron() {
  */
 function node_title_list($result, $title = NULL) {
   while ($node = db_fetch_object($result)) {
-    $items[] = l($node->title, 'node/'. $node->nid, $node->comment_count ? array('title' => format_plural($node->comment_count, '1 comment', '@count comments')) : '');
+    $items[] = l($node->title, 'node/'. $node->nid, !empty($node->comment_count) ? array('title' => format_plural($node->comment_count, '1 comment', '@count comments')) : '');
   }
 
   return theme('node_list', $items, $title);
@@ -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);
@@ -734,7 +743,7 @@ function node_prepare($node, $teaser = F
  */
 function node_build_content($node, $teaser = FALSE, $page = FALSE) {
   // Remove the delimiter (if any) that separates the teaser from the body.
-  $node->body = str_replace('<!--break-->', '', $node->body);
+  $node->body = isset($node->body) ? str_replace('<!--break-->', '', $node->body) : '';
 
   // The 'view' hook can be implemented to overwrite the default function
   // to display nodes.
@@ -1519,6 +1528,7 @@ function node_admin_nodes() {
   $form['options']['submit'] = array('#type' => 'submit', '#value' => t('Update'));
 
   $destination = drupal_get_destination();
+  $nodes = array();
   while ($node = db_fetch_object($result)) {
     $nodes[$node->nid] = '';
     $form['title'][$node->nid] = array('#value' => l($node->title, 'node/'. $node->nid) .' '. theme('mark', node_mark($node->nid, $node->changed)));
@@ -1756,6 +1766,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);
@@ -1780,7 +1791,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']);
       }
     }
@@ -1934,6 +1945,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);
@@ -2169,7 +2184,7 @@ function node_preview($node) {
     // Extract a teaser, if it hasn't been set (e.g. by a module-provided
     // 'teaser' form item).
     if (!isset($node->teaser)) {
-      $node->teaser = node_teaser($node->body, $node->format);
+      $node->teaser = empty($node->body) ? '' : node_teaser($node->body, $node->format);
     }
 
     // Display a preview of the node:

=== modified file 'modules/path/path.module'
--- modules/path/path.module	2007-03-26 01:32:22 +0000
+++ modules/path/path.module	2007-03-26 16:47:48 +0000
@@ -184,7 +184,7 @@ function path_set_alias($path = NULL, $a
 /**
  * Return a form for editing or creating an individual URL alias.
  */
-function path_form($edit = '') {
+function path_form($edit = array('src' => '', 'dst' => '', 'pid' => NULL)) {
   $form['#submit']['path_form_submit'] = array();
   $form['#validate']['path_form_validate'] = array();
   $form['#theme'] = 'path_form';
@@ -272,7 +272,7 @@ function path_nodeapi(&$node, $op, $arg)
  * Implementation of hook_form_alter().
  */
 function path_form_alter(&$form, $form_id) {
-  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
+  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
     $path = isset($form['#node']->path) ? $form['#node']->path : NULL;
     $form['path'] = array(
       '#type' => 'fieldset',
@@ -362,7 +362,7 @@ function path_load($pid) {
 function path_form_validate($form_id, $form_values) {
   $src = $form_values['src'];
   $dst = $form_values['dst'];
-  $pid = $form_values['pid'];
+  $pid = isset($form_values['pid']) ? $form_values['pid'] : 0;
   // Language is only set if locale module is enabled, otherwise save for all languages.
   $language = isset($form_values['language']) ? $form_values['language'] : '';
 
@@ -376,7 +376,7 @@ function path_form_validate($form_id, $f
  */
 function path_form_submit($form_id, $form_values) {
   // Language is only set if locale module is enabled
-  path_set_alias($form_values['src'], $form_values['dst'], $form_values['pid'], isset($form_values['language']) ? $form_values['language'] : '');
+  path_set_alias($form_values['src'], $form_values['dst'], isset($form_values['pid']) ? $form_values['pid'] : 0, isset($form_values['language']) ? $form_values['language'] : '');
 
   drupal_set_message(t('The alias has been saved.'));
   return 'admin/build/path';

=== modified file 'modules/poll/poll.module'
--- modules/poll/poll.module	2007-02-11 09:30:50 +0000
+++ modules/poll/poll.module	2007-03-26 16:53:23 +0000
@@ -133,7 +133,7 @@ function poll_form($node, $form_values =
     }
   }
   else {
-    $choices = max(2, count($node->choice) ? count($node->choice) : 5);
+    $choices = max(2, empty($node->choice) ? 5: count($node->choice));
   }
 
   $form['choices'] = array(
@@ -166,14 +166,14 @@ function poll_form($node, $form_values =
     $form['choice'][$a]['chtext'] = array(
       '#type' => 'textfield',
       '#title' => t('Choice @n', array('@n' => ($a + 1))),
-      '#default_value' => $node->choice[$a]['chtext'],
+      '#default_value' => isset($node->choice) ? $node->choice[$a]['chtext'] : '',
     );
 
     if ($admin) {
       $form['choice'][$a]['chvotes'] = array(
         '#type' => 'textfield',
         '#title' => t('Votes for choice @n', array('@n' => ($a + 1))),
-        '#default_value' => (int)$node->choice[$a]['chvotes'],
+        '#default_value' => isset($node->choice) ? (int)$node->choice[$a]['chvotes'] : 0,
         '#size' => 5, '#maxlength' => 7
       );
     }
@@ -197,7 +197,7 @@ function poll_form($node, $form_values =
   $form['settings']['runtime'] = array(
     '#type' => 'select',
     '#title' => t('Poll duration'),
-    '#default_value' => $node->runtime,
+    '#default_value' => isset($node->runtime) ? $node->runtime : 0,
     '#options' => $_duration,
     '#description' => t('After this period, the poll will be closed automatically.'),
   );
@@ -396,23 +396,25 @@ function theme_poll_view_voting($form) {
  */
 function poll_view_results(&$node, $teaser, $page, $block) {
   // Count the votes and find the maximum
+  $total_votes = 0;
+  $max_votes = 0;
   foreach ($node->choice as $choice) {
     $total_votes += $choice['chvotes'];
     $max_votes = max($max_votes, $choice['chvotes']);
   }
 
+  $poll_results = '';
   foreach ($node->choice as $i => $choice) {
     if ($choice['chtext'] != '') {
       $poll_results .= theme('poll_bar', check_plain($choice['chtext']), round($choice['chvotes'] * 100 / max($total_votes, 1)), format_plural($choice['chvotes'], '1 vote', '@count votes'), $block);
     }
   }
 
-  $output .= theme('poll_results', check_plain($node->title), $poll_results, $total_votes, $node->links, $block, $node->nid, $node->vote);
-
-  return $output;
+  return theme('poll_results', check_plain($node->title), $poll_results, $total_votes, isset($node->links) ? $node->links : array(), $block, $node->nid, isset($node->vote) ? $node->vote : NULL);
 }
 
 function theme_poll_results($title, $results, $votes, $links, $block, $nid, $vote) {
+  $output = '';
   if ($block) {
     $output .= '<div class="poll">';
     $output .= '<div class="title">'. $title .'</div>';
@@ -597,7 +599,7 @@ function poll_view($node, $teaser = FALS
     $node->links = $links;
   }
 
-  if ($node->allowvotes && ($block || arg(2) != 'results')) {
+  if (!empty($node->allowvotes) && ($block || arg(2) != 'results')) {
     if ($_POST['op'] == t('Vote')) {
       poll_vote($node);
     }

=== modified file 'modules/profile/profile.module'
--- modules/profile/profile.module	2007-02-11 09:30:50 +0000
+++ modules/profile/profile.module	2007-03-26 01:17:35 +0000
@@ -129,6 +129,7 @@ function profile_block($op = 'list', $de
   }
   else if ($op == 'view') {
     if (user_access('access user profiles')) {
+      $output = '';
       if ((arg(0) == 'node') && is_numeric(arg(1)) && (arg(2) == NULL)) {
         $node = node_load(arg(1));
         $account = user_load(array('uid' => $node->uid));
@@ -225,6 +226,16 @@ function profile_field_form($arg = NULL)
     $edit = array('name' => 'profile_');
     $form['type'] = array('#type' => 'value', '#value' => $type);
   }
+  $edit += array(
+    'category' => '',
+    'title' => '',
+    'explanation' => '',
+    'weight' => '',
+    'page' => '',
+    'autocomplete' => '',
+    'required' => '',
+    'register' => '',
+  );
   $form['fields'] = array('#type' => 'fieldset',
     '#title' => t('Field settings'),
   );

=== modified file 'modules/search/search.module'
--- modules/search/search.module	2007-03-17 18:30:14 +0000
+++ modules/search/search.module	2007-03-26 15:44:56 +0000
@@ -515,7 +515,7 @@ function search_index($sid, $type, $text
         }
       }
       else {
-        if ($tagstack[0] == $tagname) {
+        if (isset($tagstack[0]) && $tagstack[0] == $tagname) {
           // None of the tags we look for make sense when nested identically.
           // If they are, it's probably broken HTML.
           $tagstack = array();
@@ -575,6 +575,9 @@ function search_index($sid, $type, $text
               $results[$linknid][$word] += $score * $focus;
             }
             else {
+              if (!isset($results[0][$word])) {
+                $results[0][$word] = 0;
+              }
               $results[0][$word] += $score * $focus;
               // Focus is a decaying value in terms of the amount of unique words up to this point.
               // From 100 words and more, it decays, to e.g. 0.5 at 500 words and 0.3 at 1000 words.
@@ -933,7 +936,7 @@ function search_view($type = 'node') {
     return $output;
   }
 
-  return drupal_get_form('search_form', NULL, $keys, $type);
+  return drupal_get_form('search_form', NULL, empty($keys) ? array() : $keys, $type);
 }
 
 /**
@@ -1240,19 +1243,19 @@ function _search_excerpt_replace(&$text)
 function theme_search_item($item, $type) {
   $output = ' <dt class="title"><a href="'. check_url($item['link']) .'">'. check_plain($item['title']) .'</a></dt>';
   $info = array();
-  if ($item['type']) {
+  if (!empty($item['type'])) {
     $info[] = $item['type'];
   }
-  if ($item['user']) {
+  if (!empty($item['user'])) {
     $info[] = $item['user'];
   }
-  if ($item['date']) {
+  if (!empty($item['date'])) {
     $info[] = format_date($item['date'], 'small');
   }
-  if (is_array($item['extra'])) {
+  if (isset($item['extra']) && is_array($item['extra'])) {
     $info = array_merge($info, $item['extra']);
   }
-  $output .= ' <dd>'. ($item['snippet'] ? '<p>'. $item['snippet'] . '</p>' : '') . '<p class="search-info">' . implode(' - ', $info) .'</p></dd>';
+  $output .= ' <dd>'. (!empty($item['snippet']) ? '<p>'. $item['snippet'] . '</p>' : '') . '<p class="search-info">' . implode(' - ', $info) .'</p></dd>';
   return $output;
 }
 

=== modified file 'modules/statistics/statistics.module'
--- modules/statistics/statistics.module	2007-02-27 12:29:22 +0000
+++ modules/statistics/statistics.module	2007-03-26 15:48:29 +0000
@@ -200,6 +200,7 @@ function statistics_node_tracker() {
         array('data' => t('Operations')));
 
     $result = pager_query('SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path LIKE \'node/%d%%\'' . tablesort_sql($header), 30, 0, NULL, $node->nid);
+    $rows = array();
     while ($log = db_fetch_object($result)) {
       $rows[] = array(
         array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
@@ -209,9 +210,11 @@ function statistics_node_tracker() {
     }
 
     drupal_set_title(check_plain($node->title));
-    $output = theme('table', $header, $rows);
-    $output .= theme('pager', NULL, 30, 0);
-    return $output;
+    if (!empty($rows)) {
+      $output = theme('table', $header, $rows);
+      $output .= theme('pager', NULL, 30, 0);
+      return $output;
+    }
   }
   else {
     drupal_not_found();

=== modified file 'modules/system/system.module'
--- modules/system/system.module	2007-03-26 06:26:45 +0000
+++ modules/system/system.module	2007-03-26 16:56:47 +0000
@@ -462,6 +462,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;
@@ -980,7 +981,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;
@@ -1039,7 +1040,7 @@ function system_region_list($theme_key) 
  */
 function system_default_region($theme) {
   $regions = array_keys(system_region_list($theme));
-  return $regions[0];
+  return isset($regions[0]) ? $regions[0] : '';
 }
 
 /**
@@ -1147,6 +1148,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';
@@ -1155,10 +1157,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 {
@@ -1330,8 +1332,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;
   }
@@ -1503,7 +1506,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);
     }
@@ -1858,7 +1861,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'];
 }
 
 /**
@@ -2202,6 +2211,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-26 00:35:58 +0000
+++ modules/taxonomy/taxonomy.module	2007-03-26 15:43:41 +0000
@@ -28,8 +28,12 @@ function taxonomy_perm() {
 function taxonomy_link($type, $node = NULL) {
   if ($type == 'taxonomy terms' && $node != NULL) {
     $links = array();
-    if (array_key_exists('taxonomy', $node)) {
+    if (!empty($node->taxonomy)) {
       foreach ($node->taxonomy as $term) {
+        // On preview, we get tids.
+        if (is_numeric($term)) {
+          $term = taxonomy_get_term($term);
+        }
         $links['taxonomy_term_'. $term->tid] = array(
           'title' => $term->name,
           'href' => taxonomy_term_path($term),
@@ -176,7 +180,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
@@ -191,7 +195,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'));
   }
 
@@ -209,6 +213,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'],
@@ -267,7 +283,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']);
@@ -369,6 +385,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'),
@@ -394,10 +416,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);
     }
   }
 
@@ -460,12 +482,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 {
@@ -476,7 +498,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);
@@ -505,7 +527,7 @@ function taxonomy_save_term(&$form_value
   }
 
   db_query('DELETE FROM {term_synonym} WHERE tid = %d', $form_values['tid']);
-  if ($form_values['synonyms']) {
+  if (!empty($form_values['synonyms'])) {
     foreach (explode ("\n", str_replace("\r", '', $form_values['synonyms'])) as $synonym) {
       if ($synonym) {
         db_query("INSERT INTO {term_synonym} (tid, name) VALUES (%d, '%s')", $form_values['tid'], chop($synonym));
@@ -652,7 +674,7 @@ function taxonomy_get_vocabularies($type
  * Generate a form for selecting terms to associate with a node.
  */
 function taxonomy_form_alter(&$form, $form_id) {
-  if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
+  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
     $node = $form['#node'];
 
     if (!isset($node->taxonomy)) {
@@ -757,9 +779,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)) {
@@ -1276,11 +1298,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/upload/upload.module'
--- modules/upload/upload.module	2007-03-26 00:35:58 +0000
+++ modules/upload/upload.module	2007-03-26 16:54:32 +0000
@@ -309,7 +309,7 @@ function _upload_prepare(&$node) {
     // Scale image uploads.
     $file = _upload_image($file);
 
-    $key = 'upload_'. count($_SESSION['file_previews']);
+    $key = 'upload_'. (isset($_SESSION['file_previews']) ? 0 : count($_SESSION['file_previews']));
     $file->fid = $key;
     $file->source = $key;
     $file->list = variable_get('upload_list_default',1);
@@ -343,7 +343,7 @@ function upload_form_alter(&$form, $form
     );
   }
 
-  if (isset($form['type'])) {
+  if (isset($form['type']) && isset($form['#node'])) {
     $node = $form['#node'];
     if ($form['type']['#value'] .'_node_form' == $form_id && variable_get("upload_$node->type", TRUE)) {
       drupal_add_js('misc/progress.js');
@@ -402,7 +402,7 @@ function _upload_validate(&$node) {
       $file = (object)$file;
 
       // Validate new uploads.
-      if (strpos($fid, 'upload') !== FALSE && !$file->remove) {
+      if (strpos($fid, 'upload') !== FALSE && empty($file->remove)) {
         global $user;
 
         // Bypass validation for uid  = 1.
@@ -673,7 +673,7 @@ function upload_unmunge_filename($filena
 }
 
 function upload_save(&$node) {
-  if (!is_array($node->files)) {
+  if (empty($node->files) || !is_array($node->files)) {
     return;
   }
 
@@ -771,14 +771,14 @@ function _upload_form($node) {
       // Generate valid URL for both existing attachments and preview of new attachments (these have 'upload' in fid)
       $description = file_create_url((strpos($file->fid, 'upload') === FALSE ? $file->filepath : file_create_filename($file->filename, file_create_path())));
       $description = "<small>". check_plain($description) ."</small>";
-      $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => (strlen($file->description)) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description );
+      $form['files'][$key]['description'] = array('#type' => 'textfield', '#default_value' => !empty($file->description) ? $file->description : $file->filename, '#maxlength' => 256, '#description' => $description );
 
       $form['files'][$key]['size'] = array('#value' => format_size($file->filesize));
-      $form['files'][$key]['remove'] = array('#type' => 'checkbox', '#default_value' => $file->remove);
+      $form['files'][$key]['remove'] = array('#type' => 'checkbox', '#default_value' => !empty($file->remove));
       $form['files'][$key]['list'] = array('#type' => 'checkbox',  '#default_value' => $file->list);
       // if the file was uploaded this page request, set value. this fixes the problem
       // formapi has recognizing new checkboxes. see comments in _upload_prepare.
-      if ($_SESSION['file_current_upload'] == $file->fid) {
+      if (isset($_SESSION['file_current_upload']) && $_SESSION['file_current_upload'] == $file->fid) {
         $form['files'][$key]['list']['#value'] = variable_get('upload_list_default',1);
       }
       $form['files'][$key]['filename'] = array('#type' => 'value',  '#value' => $file->filename);
@@ -883,6 +883,13 @@ function upload_js() {
   _upload_validate($node);
 
   $form = _upload_form($node);
+  $form += array(
+    '#post' => $_POST,
+    '#programmed' => FALSE,
+    '#tree' => FALSE,
+    '#parents' => array(),
+  );
+  $GLOBALS['form_button_counter'] = array(0, 0);
   drupal_alter('form', $form, 'upload_js');
   $form = form_builder('upload_js', $form);
   $output = theme('status_messages') . drupal_render($form);

=== modified file 'modules/user/user.module'
--- modules/user/user.module	2007-03-26 00:35:58 +0000
+++ modules/user/user.module	2007-03-26 05:53:24 +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);
@@ -1428,7 +1430,8 @@ function user_edit_form($uid, $edit, $re
     $roles = user_roles(1);
     unset($roles[DRUPAL_AUTHENTICATED_RID]);
     if ($roles) {
-      $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => array_keys((array)$edit['roles']), '#options' => $roles, '#description' => t('The user receives the combined permissions of the %au role, and all roles selected here.', array('%au' => t('authenticated user'))));
+      $default = empty($edit['roles']) ? array() : array_keys($edit['roles']);
+      $form['account']['roles'] = array('#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => $default, '#options' => $roles, '#description' => t('The user receives the combined permissions of the %au role, and all roles selected here.', array('%au' => t('authenticated user'))));
     }
   }
 
@@ -1792,7 +1795,7 @@ function user_admin_access_form($edit, $
   $form['status'] = array(
     '#type' => 'radios',
     '#title' => t('Access type'),
-    '#default_value' => $edit['status'],
+    '#default_value' => isset($edit['status']) ? $edit['status'] : array(),
     '#options' => array('1' => t('Allow'), '0' => t('Deny')),
   );
   $type_options = array('user' => t('Username'), 'mail' => t('E-mail'), 'host' => t('Host'));
@@ -1830,9 +1833,7 @@ function user_admin_access() {
   if (empty($rows)) {
     $rows[] = array(array('data' => '<em>'. t('There are currently no access rules.') .'</em>', 'colspan' => 5));
   }
-  $output .= theme('table', $header, $rows);
-
-  return $output;
+  return theme('table', $header, $rows);
 }
 
 /**
@@ -1917,7 +1918,7 @@ function user_admin_perm($rid = NULL) {
 
   // Have to build checkboxes here after checkbox arrays are built
   foreach ($role_names as $rid => $name) {
-    $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => $status[$rid]);
+    $form['checkboxes'][$rid] = array('#type' => 'checkboxes', '#options' => $options, '#default_value' => isset($status[$rid]) ? $status[$rid] : array());
     $form['role_names'][$rid] = array('#value' => $name, '#tree' => TRUE);
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Save permissions'));
@@ -2023,7 +2024,6 @@ function user_admin_role() {
     );
     $form['#submit']['user_admin_role_submit'] = array();
     $form['#validate']['user_admin_role_validate'] = array();
-    $form['#theme'] = 'user_admin_role';
   }
   return $form;
 }
@@ -2126,7 +2126,7 @@ function user_admin_account() {
 
   $status = array(t('blocked'), t('active'));
   $roles = user_roles(1);
-
+  $accounts = array();
   while ($account = db_fetch_object($result)) {
     $accounts[$account->uid] = '';
     $form['name'][$account->uid] = array('#value' => theme('username', $account));
@@ -2564,10 +2564,12 @@ function user_filters() {
   $roles = user_roles(1);
   unset($roles[DRUPAL_AUTHENTICATED_RID]); // Don't list authorized role.
   if (count($roles)) {
-    $filters['role'] = array('title' => t('role'),
-                         'where' => "ur.rid = %d",
-                         'options' => $roles,
-                       );
+    $filters['role'] = array(
+      'title' => t('role'),
+      'where' => "ur.rid = %d",
+      'options' => $roles,
+      'join' => '',
+    );
   }
 
   $options = array();
@@ -2581,16 +2583,19 @@ function user_filters() {
     }
   }
   ksort($options);
-  $filters['permission'] = array('title' => t('permission'),
-                             'join' => 'LEFT JOIN {permission} p ON ur.rid = p.rid',
-                             'where' => " ((p.perm IS NOT NULL AND p.perm LIKE '%%%s%%') OR u.uid = 1) ",
-                             'options' => $options,
-                           );
-
-  $filters['status'] = array('title' => t('status'),
-                         'where' => 'u.status = %d',
-                         'options' => array(1 => t('active'), 0 => t('blocked')),
-                       );
+  $filters['permission'] = array(
+    'title' => t('permission'),
+    'join' => 'LEFT JOIN {permission} p ON ur.rid = p.rid',
+    'where' => " ((p.perm IS NOT NULL AND p.perm LIKE '%%%s%%') OR u.uid = 1) ",
+    'options' => $options,
+  );
+
+  $filters['status'] = array(
+    'title' => t('status'),
+    'where' => 'u.status = %d',
+    'join' => '',
+    'options' => array(1 => t('active'), 0 => t('blocked')),
+  );
   return $filters;
 }
 
@@ -2618,8 +2623,8 @@ function user_build_filter_query() {
     $args[] = $value;
     $join[] = $filters[$key]['join'];
   }
-  $where = count($where) ? 'AND '. implode(' AND ', $where) : '';
-  $join = count($join) ? ' '. implode(' ', array_unique($join)) : '';
+  $where = !empty($where) ? 'AND '. implode(' AND ', $where) : '';
+  $join = !empty($join) ? ' '. implode(' ', array_unique($join)) : '';
 
   return array('where' => $where,
            'join' => $join,
@@ -2695,7 +2700,7 @@ function theme_user_filters($form) {
     }
   }
 
-  $output .= '<li><dl class="multiselect">'. (sizeof($form['current']) ? '<dt><em>'. t('and') .'</em> '. t('where') .'</dt>' : '') .'<dd class="a">';
+  $output .= '<li><dl class="multiselect">'. (!empty($form['current']) ? '<dt><em>'. t('and') .'</em> '. t('where') .'</dt>' : '') .'<dd class="a">';
   foreach (element_children($form['filter']) as $key) {
     $output .= drupal_render($form['filter'][$key]);
   }

=== modified file 'profiles/default/default.profile'
--- profiles/default/default.profile	2007-03-25 20:49:06 +0000
+++ profiles/default/default.profile	2007-03-26 00:21:05 +0000
@@ -44,6 +44,8 @@ function default_profile_final() {
       'custom' => TRUE,
       'modified' => TRUE,
       'locked' => FALSE,
+      'help' => '',
+      'min_word_count' => '',
     ),
     array(
       'type' => 'story',
@@ -53,6 +55,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-26 01:32:22 +0000
+++ themes/engines/phptemplate/phptemplate.engine	2007-03-26 05:59:12 +0000
@@ -202,15 +202,15 @@ function phptemplate_page($content, $sho
     'head_title'          => implode(' | ', $head_title),
     'help'                => theme('help'),
     'language'            => $GLOBALS['language'],
-    '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,11 +261,20 @@ 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')) : '',
+    'links'          => !empty($node->links) ? theme('links', $node->links, array('class' => 'links inline')) : '',
     'name'           => theme('username', $node),
     'node'           => $node,  // we pass the actual node to allow more customization
     'node_url'       => url('node/'. $node->nid),

=== modified file 'themes/garland/block.tpl.php'
--- themes/garland/block.tpl.php	2006-10-29 13:17:37 +0000
+++ themes/garland/block.tpl.php	2007-03-26 16:11:06 +0000
@@ -1,6 +1,6 @@
 <div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?>">
 
-<?php if ($block->subject): ?>
+<?php if (!empty($block->subject)): ?>
   <h2><?php print $block->subject ?></h2>
 <?php endif;?>
 

