Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.263
diff -u -r1.263 theme.inc
--- includes/theme.inc	22 Oct 2005 15:14:46 -0000	1.263
+++ includes/theme.inc	22 Oct 2005 23:09:38 -0000
@@ -508,8 +508,23 @@
  * @return
  *   A string containing the themed links.
  */
-function theme_links($links, $delimiter = ' | ') {
-  return implode($delimiter, $links);
+function theme_links($links = array(), $delimiter = ' | ') {
+  if (!empty($links)) {
+    if (is_array($links)) {
+      if (sizeof($links) > 1) {
+        return implode($delimiter, $links);
+      }
+      elseif (sizeof($links) === 1) {
+        return $links[0];
+      }
+    }
+    elseif(is_string($links)) {
+      return $links;
+    }
+  }
+  else {
+    return '';
+  }
 }
 
 /**
@@ -771,7 +786,7 @@
  *   A themed sort icon.
  */
 function theme_tablesort_indicator($style) {
-  if ($style == "asc"){
+  if ($style == 'asc'){
     return theme('image', 'misc/arrow-asc.png', t('sort icon'), t('sort ascending'));
   }
   else {
@@ -957,7 +972,8 @@
   }
 
   // Add any content assigned to this region through drupal_set_content() calls.
-  $output .= drupal_get_content($region);
+  $content = drupal_get_content($region);
+  $output .= empty($content) ? '' : $content;
 
   return $output;
 }
Index: modules/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter.module,v
retrieving revision 1.77
diff -u -r1.77 filter.module
--- modules/filter.module	22 Oct 2005 15:14:46 -0000	1.77
+++ modules/filter.module	22 Oct 2005 23:09:39 -0000
@@ -644,7 +644,7 @@
 function filter_list_format($format) {
   static $filters = array();
 
-  if (!is_array($filters[$format])) {
+  if (!isset($filters[$format]) || !is_array($filters[$format])) {
     $filters[$format] = array();
     $result = db_query("SELECT * FROM {filters} WHERE format = %d ORDER BY weight ASC", $format);
     while ($filter = db_fetch_object($result)) {
Index: modules/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node.module,v
retrieving revision 1.538
diff -u -r1.538 node.module
--- modules/node.module	22 Oct 2005 15:14:46 -0000	1.538
+++ modules/node.module	22 Oct 2005 23:09:42 -0000
@@ -98,7 +98,7 @@
 function node_tag_new($nid) {
   global $user;
 
-  if ($user->uid) {
+  if (!empty($user->uid)) {
     if (node_last_viewed($nid)) {
       db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', time(), $user->uid, $nid);
     }
@@ -211,7 +211,7 @@
       $node_list[$type] = $value['name'];
     }
   }
-  if ($node) {
+  if (isset($node)) {
     if (is_array($node)) {
       $type = $node['type'];
     }
@@ -347,7 +347,7 @@
 function node_load($param = array(), $revision = NULL, $reset = NULL) {
   static $nodes = array();
 
-  if ($reset) {
+  if (!empty($reset)) {
     $nodes = array();
   }
 
@@ -374,7 +374,7 @@
     $node = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE '. $cond)));
   }
 
-  if ($node->nid) {
+  if (isset($node->nid)) {
     // Call the node specific callback (if any) and piggy-back the
     // results to the node or overwrite some values.
     if ($extra = node_invoke($node, 'load')) {
@@ -406,12 +406,12 @@
   $node->is_new = false;
 
   // Apply filters to some default node fields:
-  if (empty($node->nid)) {
+  if (is_null($node->nid)) {
     // Insert a new node.
     $node->is_new = true;
 
     // Set some required fields:
-    if (!$node->created) {
+    if (empty($node->created)) {
       $node->created = time();
     }
     $node->nid = db_next_id('{node}_nid');
@@ -425,7 +425,7 @@
     }
     $node = $node_current;
 
-    if ($node->revision) {
+    if (!is_null($node->revision)) {
       $node->old_vid = $node->vid;
       $node->vid = db_next_id('{node_revisions}_vid');
       // We always update the timestamp for new revisions.
@@ -433,7 +433,7 @@
     }
   }
 
-  if (!$node->changed) {
+  if (is_null($node->changed)) {
     $node->changed = time();
   }
 
@@ -461,7 +461,7 @@
 
   //Generate the node table query and the
   //the node_revisions table query
-  if ($node->is_new) {
+  if ($node->is_new === true) {
     $node_query = 'INSERT INTO {node} ('. implode(', ', array_keys($node_table_types)) .') VALUES ('. implode(', ', $node_table_types) .')';
     $revisions_query = 'INSERT INTO {node_revisions} ('. implode(', ', array_keys($revisions_table_types)) .') VALUES ('. implode(', ', $revisions_table_types) .')';
   }
@@ -490,7 +490,7 @@
   db_query($revisions_query, $revisions_table_values);
 
   // Call the node specific callback (if any):
-  if ($node->is_new) {
+  if ($node->is_new === true) {
     node_invoke($node, 'insert');
     node_invoke_nodeapi($node, 'insert');
   }
@@ -539,7 +539,7 @@
   }
   // Allow modules to change $node->body before viewing.
   node_invoke_nodeapi($node, 'view', $teaser, $page);
-  if ($links) {
+  if ($links === true) {
     $node->links = module_invoke_all('link', 'node', $node, !$page);
   }
   // unset unused $node part so that a bad theme can not open a security hole
@@ -932,7 +932,7 @@
 
 function node_last_changed($nid) {
   $node = db_fetch_object(db_query('SELECT changed FROM {node} WHERE nid = %d', $nid));
-  return ($node->changed);
+  return (isset($node->changed) ? $node->changed : NULL);
 }
 
 /*
@@ -1071,7 +1071,7 @@
 
 function node_filter_form_execute() {
   global $form_values;
-  $op = $_POST['op'];
+  $op = isset($_POST['op']) ? $_POST['op'] : '';
   $filters = node_filters();
   switch ($op) {
     case t('Filter'): case t('Refine'):
@@ -1091,7 +1091,7 @@
     case t('Update'):
       return;
   }
-  if ($op != '') {
+  if ($op !== '') {
     drupal_goto('admin/node');
   }
 }
@@ -1385,11 +1385,11 @@
  * Implementation of hook_block().
  */
 function node_block($op = 'list', $delta = 0) {
-  if ($op == 'list') {
+  if ($op === 'list') {
     $blocks[0]['info'] = t('Syndicate');
     return $blocks;
   }
-  else if ($op == 'view') {
+  else if ($op === 'view') {
     $block['subject'] = t('Syndicate');
     $block['content'] = theme('xml_icon', url('node/feed'));
 
@@ -1598,7 +1598,7 @@
   $form['changed'] = array('#type' => 'value', '#value' => $node->changed);
   $form['type']    = array('#type' => 'value', '#value' => $node->type);
 
-  if ($op == t('Preview')) {
+  if ($op === t('Preview')) {
     $form['node_preview'] = array('#value' => node_preview(array2object($_POST['edit'])), '#weight' => -100);
   }
 
@@ -1649,7 +1649,7 @@
   // Add the buttons.
   $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 19);
 
-  if ($node->type) {
+  if (isset($node->type)) {
     if (!form_get_errors()) {
       if ($_POST['op'] == t('Preview')|| !variable_get('node_preview', 0)) {
 
@@ -1657,7 +1657,7 @@
     }
   }
   $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'), '#weight' => 20);
-  if ($node->nid && node_access('delete', $node)) {
+  if (isset($node->nid) && node_access('delete', $node)) {
     $form['delete'] = array('#type' => 'button', '#value' => t('Delete'), '#weight' => 21);
   }
   return drupal_get_form($node->type . '_node_form', $form, 'node_form');
@@ -1700,7 +1700,7 @@
     // Allow the following fields to be initialized via $_GET (e.g. for use
     // with a "blog it" bookmarklet):
     foreach (array('title', 'teaser', 'body') as $field) {
-      if ($_GET['edit'][$field]) {
+      if (isset($_GET['edit'][$field]) && $_GET['edit'][$field]) {
         $node[$field] = $_GET['edit'][$field];
       }
     }
@@ -1749,7 +1749,7 @@
         $node->uid = 0; // anonymous user
       }
     }
-    else if ($node->uid) {
+    else if (!empty($node->uid)) {
       $user = user_load(array('uid' => $node->uid));
       $node->name = $user->name;
     }
@@ -1812,7 +1812,7 @@
   }
 
   // Prepare the node's body:
-  if ($node->nid) {
+  if (isset($node->nid)) {
     // Check whether the current user has the proper access rights to
     // perform this operation:
     if (node_access('update', $node)) {
@@ -1830,7 +1830,7 @@
       $msg = t('Your %post was created.', array ('%post' => node_get_name($node)));
     }
   }
-  if ($node->nid) {
+  if (isset($node->nid)) {
     if (node_access('view', $node)) {
       drupal_goto('node/'. $node->nid);
     }
@@ -1934,7 +1934,7 @@
     case 'view':
       if (is_numeric(arg(1))) {
         $node = node_load(arg(1), $_GET['revision']);
-        if ($node->nid) {
+        if (isset($node->nid)) {
           drupal_set_title(check_plain($node->title));
           return node_show($node, arg(2));
         }
@@ -1975,7 +1975,7 @@
 
       if (is_numeric(arg(1))) {
         $node = node_load(arg(1));
-        if ($node->nid) {
+        if (isset($node->nid)) {
           drupal_set_title(check_plain($node->title));
           return node_form($node);
         }
@@ -1990,7 +1990,7 @@
     case 'revision':
       if (is_numeric(arg(1)) && is_numeric(arg(3))) {
         $node = node_load(arg(1), arg(3));
-        if ($node->nid) {
+        if (isset($node->nid)) {
           drupal_set_title(t('Revision of %title', array('%title' => theme('placeholder', $node->title))));
           print theme('page', node_show($node, arg(2)));
         }
@@ -2156,7 +2156,7 @@
 
   // If the module did not override the access rights, use those set in the
   // node_access table.
-  if ($node->nid && $node->status) {
+  if (isset($node->nid) && $node->status) {
     $sql = 'SELECT COUNT(*) FROM {node_access} WHERE (nid = 0 OR nid = %d) AND CONCAT(realm, gid) IN (';
     $grants = array();
     foreach (node_access_grants($op, $uid) as $realm => $gids) {
Index: modules/path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path.module,v
retrieving revision 1.67
diff -u -r1.67 path.module
--- modules/path.module	11 Oct 2005 19:44:35 -0000	1.67
+++ modules/path.module	22 Oct 2005 23:09:42 -0000
@@ -182,8 +182,8 @@
   if (user_access('create url aliases') || user_access('administer url aliases')) {
     switch ($op) {
       case 'validate':
-        $node->path = trim($node->path);
-        if ($node->path && !valid_url($node->path)) {
+        $node->path = isset($node->path) ? trim($node->path) : '';
+        if (!empty($node->path) && !valid_url($node->path)) {
           form_set_error('path', t('The path is invalid.'));
         }
         else if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s'", $node->path, "node/$node->nid"))) {
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.245
diff -u -r1.245 system.module
--- modules/system.module	22 Oct 2005 15:14:46 -0000	1.245
+++ modules/system.module	22 Oct 2005 23:09:44 -0000
@@ -942,7 +942,9 @@
   file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
 
   // Default settings are defined in theme_get_settings() in includes/theme.inc
-  if ($key) {
+  // $key is the theme name and should contain a string of the theme name when
+  // making theme-specific configuration changes
+  if (!empty($key)) {
     $settings = theme_get_settings($key);
     $var = str_replace('/', '_', 'theme_'. $key .'_settings');
     $themes = system_theme_data();
@@ -984,7 +986,7 @@
 
 
   // Logo settings
-  if ((!$key) || in_array('logo', $features)) {
+  if (empty($key) || in_array('logo', $features)) {
     $form['logo'] = array('#type' => 'fieldset', '#title' => t('Logo image settings'));
     $form['logo']["default_logo"] = array(
       '#type' => 'checkbox', '#title' => t('Use the default logo'), '#default_value' => $settings['default_logo'], '#tree' => FALSE,
@@ -1001,7 +1003,7 @@
   }
 
   // Icon settings
-  if ((!$key) || in_array('toggle_favicon', $features)) {
+  if (empty($key) || in_array('toggle_favicon', $features)) {
     $form['favicon'] = array('#type' => 'fieldset', '#title' => t('Shortcut icon settings'));
     $form['favicon']['text'] = array('#value' => t('Your shortcut icon or \'favicon\' is displayed in the address bar and bookmarks of most browsers.'));
     $form['favicon']['default_favicon'] = array(
@@ -1019,7 +1021,7 @@
   }
 
   // System wide only settings.
-  if (!$key) {
+  if (empty($key)) {
     // Menu settings
 
     $form['primary_links'] = system_navigation_links_form('primary', 'Primary');
@@ -1072,7 +1074,7 @@
     }
   }
 
-  if ($key) {
+  if (!empty($key)) {
     // Template-specific settings
     $function = $themes[$key]->prefix .'_settings';
     if (function_exists($function)) {
@@ -1091,7 +1093,6 @@
   $form['#attributes'] = array('enctype' => 'multipart/form-data');
 
   return system_settings_form('system_theme_settings', $form);
-
 }
 
 function system_navigation_links_form($type, $utype) {
Index: modules/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v
retrieving revision 1.232
diff -u -r1.232 taxonomy.module
--- modules/taxonomy.module	21 Oct 2005 11:12:46 -0000	1.232
+++ modules/taxonomy.module	22 Oct 2005 23:09:45 -0000
@@ -25,7 +25,7 @@
  * }
  */
 function taxonomy_link($type, $node = NULL) {
-  if ($type == 'taxonomy terms' && $node != NULL) {
+  if ($type == 'taxonomy terms' && !is_null($node)) {
     $links = array();
     if (array_key_exists('taxonomy', $node)) {
       foreach ($node->taxonomy as $tid) {
@@ -34,8 +34,10 @@
       }
     }
     else {
-      foreach (taxonomy_node_get_terms($node->nid) as $term) {
-        $links[] = l($term->name, taxonomy_term_path($term));
+      if (isset($node->nid)) {
+        foreach (taxonomy_node_get_terms($node->nid) as $term) {
+          $links[] = l($term->name, taxonomy_term_path($term));
+        }
       }
     }
     return $links;
@@ -775,7 +777,7 @@
         $terms[$vid][$child]->parents = $parents[$vid][$child];
         $tree[] = $terms[$vid][$child];
 
-        if ($children[$vid][$child]) {
+        if (isset($children[$vid][$child])) {
           $tree = array_merge($tree, taxonomy_get_tree($vid, $child, $depth, $max_depth));
         }
       }
@@ -920,7 +922,8 @@
 }
 
 function _taxonomy_depth($depth, $graphic = '--') {
-  for ($n = 0; $n < $depth; $n++) {
+  $result = '';
+  for ($n = 0; $n < $depth; $n+=1) {
     $result .= $graphic;
   }
   return $result;
Index: themes/engines/phptemplate/phptemplate.engine
===================================================================
RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v
retrieving revision 1.20
diff -u -r1.20 phptemplate.engine
--- themes/engines/phptemplate/phptemplate.engine	22 Oct 2005 15:14:46 -0000	1.20
+++ themes/engines/phptemplate/phptemplate.engine	22 Oct 2005 23:09:45 -0000
@@ -186,11 +186,13 @@
     }
   }
 
+  $footer_message = variable_get('site_footer', FALSE) . "\n" . theme('blocks', 'footer');
+
   $variables = array(
     'breadcrumb'          => theme('breadcrumb', drupal_get_breadcrumb()),
     'closure'             => theme('closure'),
     'content'             => '<!-- begin content -->' . $content . '<!-- end content -->',
-    'footer_message'      => variable_get('site_footer', FALSE) . "\n" . theme('blocks', 'footer'),
+    'footer_message'      => empty($footer_message) ? '' : $footer_message,
     'head'                => drupal_get_html_head(),
     'head_title'          => implode(' | ', $head_title),
     'help'                => theme('help'),
