Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.1.2.48
diff -u -p -r1.1.2.48 pathauto.inc
--- pathauto.inc	30 May 2008 01:41:32 -0000	1.1.2.48
+++ pathauto.inc	1 Jun 2008 13:28:10 -0000
@@ -67,7 +67,7 @@ function _pathauto_alias_exists($alias, 
   if (db_table_exists('path_redirect')) {
     $redirect_rid = db_result(db_query_range("SELECT rid FROM {path_redirect} WHERE path = '%s'", $alias, 0, 1));
   }
-  if ($alias_pid || $redirect_rid) {
+  if ($alias_pid || (isset($redirect_rid) && $redirect_rid)) {
     return TRUE;
   }
   else {
@@ -186,7 +186,7 @@ function pathauto_cleanstring($string, $
   $output = preg_replace("/\s+/", $separator, $output);
 
   // In preparation for pattern matching,
-  // escape the separator if and only if it is not alphanumeric)
+  // escape the separator if and only if it is not alphanumeric.
   if (isset($separator)) {
     if (preg_match('/^[^'. PREG_CLASS_ALNUM .']+$/uD', $separator)) {
       $seppattern = $separator;
@@ -240,15 +240,14 @@ function pathauto_create_alias($module, 
 
   // Retrieve and apply the pattern for this content type
   $pattern = '';
-  if ($type) {
-    $pattern = variable_get('pathauto_'. $module .'_'. $type .'_pattern', '');
+  if (!empty($type)) {
+    $pattern = trim(variable_get('pathauto_'. $module .'_'. $type .'_pattern', ''));
   }
-  if (!trim($pattern)) {
-    $pattern = variable_get('pathauto_'. $module .'_pattern', '');
+  if (!$pattern) {
+    $pattern = trim(variable_get('pathauto_'. $module .'_pattern', ''));
   }
-
   // No pattern? Do nothing (otherwise we may blow away existing aliases...)
-  if (!trim($pattern)) {
+  if (!$pattern) {
     return '';
   }
 
@@ -363,7 +360,7 @@ function _pathauto_path_is_callback($pat
  * @param $pid
  *   If the item is currently aliased, the pid for that item.
  * @param $verbose
- *   If the admin has enabled verbose, should be TRUE.  Else FALSE or NULL.
+ *   If the admin has enabled verbose, should be TRUE. Else FALSE or NULL.
  * @param $old_alias
  *   If the item is currently aliased, the existing alias for that item.
  */
@@ -376,7 +373,7 @@ function _pathauto_set_alias($src, $dst,
     return;
   }
   // Alert users if they are trying to create an alias that is the same as the internal path
-  else if ($src == $dst) {
+  if ($src == $dst) {
     if ($verbose and user_access('notify of path changes')) {
       drupal_set_message(t('Ignoring alias %dst because it is the same as the internal path.', array('%dst' => $dst)));
     }
@@ -466,7 +463,7 @@ function pathauto_clean_token_values($fu
 function pathauto_punctuation_chars() {
   $punctuation = array();
 
-  // Handle " ' , . - _ : ; | { { } ] + = * & % $ � # @ ! ~ ( ) ? < > \
+  // Handle " ' , . - _ : ; | { { } ] + = * & % $ � # @ ! ~ ( ) ? < > \ � �
   $punctuation['double_quotes']      = array('value' => '"', 'name' => t('Double quotes "'));
   $punctuation['quotes']             = array('value' => "'", 'name' => t("Single quotes (apostrophe) '"));
   $punctuation['backtick']           = array('value' => '`', 'name' => t('Back tick `'));
Index: pathauto.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v
retrieving revision 1.44.4.94
diff -u -p -r1.44.4.94 pathauto.module
--- pathauto.module	30 May 2008 00:58:55 -0000	1.44.4.94
+++ pathauto.module	1 Jun 2008 13:28:10 -0000
@@ -89,7 +89,325 @@ function _pathauto_include() {
 }
 
 /**
- * Callback for admin settings page.
+ * Implementation of hook_token_values() for Pathauto specific tokens.
+ */
+function pathauto_token_values($type, $object = NULL) {
+  if (module_exists('taxonomy')) {
+    if ($type == 'taxonomy' || $type == 'node' || $type == 'all') {
+      _pathauto_include();
+      switch ($type) {
+        case 'node':
+          $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name", $object->nid, 0, 1));
+          $category = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight", $vid, $object->nid, 0, 1));
+          $category->vid = $vid;
+          // In the realm of nodes these are terms, in the realm of Taxonomy, cats
+          $label = 'term';
+
+          // We're on a node and it's a book and it has a parent? Get the book path alias
+          if (module_exists('book')) {
+            if ($object->type == 'book' && $object->parent) {
+              $values['bookpathalias'] = drupal_get_path_alias('node/'. $object->parent);
+            }
+            else {
+              $values['bookpathalias'] = '';
+            }
+          }
+
+        case 'taxonomy':
+        default:
+          if (!isset($category)) {
+            $category = $object;
+          }
+          if (!isset($label)) {
+            $label = 'cat';
+          }
+          if (isset($category->tid)) {
+            $separator = variable_get('pathauto_separator', '-');
+            $parents = taxonomy_get_parents_all($category->tid);
+            array_shift($parents);
+            $catpath = '';
+            $catpath_raw = '';
+            foreach ($parents as $parent) {
+              // Replace any / characters in individual terms which might create confusing URLs
+              $catpath = pathauto_cleanstring(check_plain(preg_replace('/\//', '', $parent->name))) .'/'. $catpath;
+              $catpath_raw = pathauto_cleanstring(preg_replace('/\//', '', $parent->name)) .'/'. $catpath_raw;
+            }
+            $values[$label .'path'] = $catpath .'/'. check_plain($category->name);
+            $values[$label .'path-raw'] = $catpath_raw .'/'. $category->name;
+
+            // We only do this for taxonomy because token already provides the [term] value but has problem with [cat] TODO: fix that?
+            if ($type == 'taxonomy') {
+              $values[$label] = check_plain($category->name);
+              $values[$label .'-raw'] = $category->name;
+            }
+
+            $values[$label .'alias'] = drupal_get_path_alias('taxonomy/term/'. $category->tid);
+            if (!strncasecmp($values[$label .'alias'], 'taxonomy', 8)) {
+              $values[$label .'alias'] = $values[$label];
+            }
+          }
+          else { // Provide some defaults if they aren't set.
+            $values[$label .'path'] = '';
+            $values[$label .'path-raw'] = '';
+            $values[$label .'alias'] = '';
+          }
+      }
+      return $values;
+    }
+  }
+}
+
+/**
+ * Implementation of hook_token_list() for Pathauto specific tokens.
+ */
+function pathauto_token_list($type = 'all') {
+  $tokens = array();
+  if (module_exists('taxonomy')) {
+    if ($type == 'taxonomy' || $type == 'all') {
+      $tokens['taxonomy']['catpath'] = t('As [cat], but including its supercategories separated by /.');
+      $tokens['taxonomy']['catpath-raw'] = t('As [cat-raw], but including its supercategories separated by /. WARNING - raw user input.');
+      $tokens['taxonomy']['catalias'] = t('URL alias for the category.');
+    }
+    if ($type == 'node' || $type == 'all') {
+      $tokens['node']['termpath'] = t('As [term], but including its supercategories separated by /.');
+      $tokens['node']['termpath-raw'] = t('As [term-raw], but including its supercategories separated by /. WARNING - raw user input.');
+      $tokens['node']['termalias'] = t('URL alias for the term.');
+    }
+  }
+  if (module_exists('book')) {
+    if ($type == 'node' || $type == 'all') {
+      $tokens['node']['bookpathalias'] = t('URL alias for the parent book.');
+    }
+  }
+  return $tokens;
+}
+
+/**
+ * Implementation of hook_path_alias_types().
+ *
+ * Used primarily by the bulk delete form.
+ */
+function pathauto_path_alias_types() {
+  $objects = array('user/' => t('users'), 'node/' => t('content'));
+  if (module_exists('blog')) {
+    $objects['blog/'] = t('user blogs');
+  }
+  if (module_exists('taxonomy')) {
+    $objects['taxonomy/'] = t('vocabularies and terms');
+  }
+  if (module_exists('taxonomy')) {
+    $objects['user/%/track'] = t('user trackers');
+  }
+  if (module_exists('forum')) {
+    $objects['forum/%'] = t('forums');
+  }
+
+  return $objects;
+}
+
+//==============================================================================
+// Some node related functions.
+
+/**
+ * Implementation of hook_nodeapi().
+ */
+function pathauto_nodeapi(&$node, $op, $teaser, $page) {
+  _pathauto_include();
+  if (module_exists('path')) {
+    switch ($op) {
+      case 'insert':
+      case 'update':
+        // Get the specific pattern or the default
+        $pattern = variable_get('pathauto_node_'. $node->type .'_pattern', FALSE);
+        if (!$pattern) {
+          $pattern = variable_get('pathauto_node_pattern', FALSE);
+        }
+        // Only do work if there's a pattern
+        if ($pattern) {
+          // Only create an alias if the checkbox was not provided or if the checkbox was provided and is checked
+          if (!isset($node->pathauto_perform_alias) || $node->pathauto_perform_alias) {
+            $placeholders = pathauto_get_placeholders('node', $node);
+            $src = "node/$node->nid";
+            $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->nid, $node->type);
+          }
+        }
+        break;
+      case 'delete':
+        path_set_alias('node/'. $node->nid);
+        path_set_alias('node/'. $node->nid .'/feed');
+        break;
+      default:
+        break;
+    }
+  }
+}
+
+/**
+ * Implementation of hook_form_alter().
+ *
+ * This allows alias creators to override Pathauto and specify their
+ * own aliases (Pathauto will be invisible to other users). Inserted
+ * into the path module's fieldset in the node form.
+ */
+function pathauto_form_alter($formid, &$form) {
+  // Only do this for node forms
+  if (isset($form['#id']) && ($form['#id'] == 'node-form') && arg(0) == 'node') {
+    // See if there is a pathauto pattern or default applicable
+    $pattern = variable_get('pathauto_node_'. $form['type']['#value'] .'_pattern', FALSE);
+    if (!$pattern) {
+      $pattern = variable_get('pathauto_node_pattern', FALSE);
+    }
+    // If there is a pattern AND the user is allowed to create aliases AND the path textbox is present on this form
+    if ($pattern && user_access('create url aliases') && isset($form['path']['path'])) {
+      $output = t('An alias will be generated for you. If you wish to create your own alias below, untick this option.');
+      if (user_access('administer pathauto')) {
+        $output .= t(' To control the format of the generated aliases, see the <a href="@pathauto">Pathauto settings</a>.', array('@pathauto' => url('admin/settings/pathauto')));
+      }
+
+      drupal_add_js(drupal_get_path('module', 'pathauto') .'/pathauto.js');
+
+      $form['path']['pathauto_perform_alias'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Automatic alias'),
+        '#default_value' => TRUE,
+        '#description' => $output,
+        '#weight' => 0
+      );
+    }
+  }
+}
+
+/**
+ * Implementation of hook_node_operations().
+ */
+function pathauto_node_operations() {
+  $operations = array(
+    'update_alias' => array(
+      'label' => t('Update path alias'),
+      'callback' => 'pathauto_node_operations_update',
+    ),
+  );
+  return $operations;
+}
+
+/**
+ * Callback function for updating node aliases.
+ *
+ * @param $nodes
+ *   Array of node nid's.
+ */
+function pathauto_node_operations_update($nodes) {
+  foreach ($nodes as $nid) {
+    $node = node_load($nid);
+    $placeholders = pathauto_get_placeholders('node', $node);
+    pathauto_create_alias('node', 'bulkupdate', $placeholders, "node/$node->nid", $node->nid, $node->type);
+  }
+}
+
+//==============================================================================
+// Taxonomy related functions.
+
+/**
+ * Implementation of hook_taxonomy().
+ */
+function pathauto_taxonomy($op, $type, $object = NULL) {
+  _pathauto_include();
+  switch ($type) {
+    case 'term':
+      switch ($op) {
+        case 'insert':
+        case 'update':
+          // Use the category info to automatically create an alias
+          $category = (object) $object;
+          if ($category->name) {
+            $count = _taxonomy_pathauto_alias($category, $op);
+          }
+
+          // For all children generate new alias (important if [catpath] used)
+          foreach (taxonomy_get_tree($category->vid, $category->tid) as $subcategory) {
+            $count = _taxonomy_pathauto_alias($subcategory, $op);
+          }
+
+          break;
+        case 'delete':
+          // If the category is deleted, remove the path aliases
+          $category = (object) $object;
+          path_set_alias('taxonomy/term/'. $category->tid);
+          path_set_alias(taxonomy_term_path($category));
+          path_set_alias('forum/'. $category->tid);
+          path_set_alias('taxonomy/term/'. $category->tid .'/0/feed');
+          break;
+        default:
+          break;
+      }
+      break;
+    default:
+      break;
+  }
+}
+
+//==============================================================================
+// User related functions.
+
+/**
+ * Implementation of hook_user() for users, trackers, and blogs.
+ */
+function pathauto_user($op, &$edit, &$user, $category = FALSE) {
+  _pathauto_include();
+  switch ($op) {
+    case 'insert':
+    case 'update':
+      // Use the username to automatically create an alias
+      $pathauto_user = (object) array_merge((array) $user, $edit);
+      if ($user->name) {
+        $placeholders = pathauto_get_placeholders('user', $pathauto_user);
+        $src = 'user/'. $user->uid;
+        $alias = pathauto_create_alias('user', $op, $placeholders, $src, $user->uid);
+
+        if (module_exists('blog')) {
+          $new_user = $user;
+          $new_user->roles = isset($edit['roles']) ? $edit['roles'] : array();
+          $new_user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; // Add this back
+          if (user_access('edit own blog', $new_user)) {
+            $src = 'blog/'. $user->uid;
+            $alias = pathauto_create_alias('blog', $op, $placeholders, $src, $user->uid);
+          }
+          else {
+            path_set_alias('blog/'. $user->uid);
+            path_set_alias('blog/'. $user->uid .'/feed');
+          }
+        }
+        if (module_exists('tracker')) {
+          $src = 'user/'. $user->uid .'/track';
+          $alias = pathauto_create_alias('tracker', $op, $placeholders, $src, $user->uid);
+        }
+      }
+      break;
+    case 'delete':
+      // If the user is deleted, remove the path aliases
+      $user = (object) $user;
+      path_set_alias('user/'. $user->uid);
+
+      // They may have enabled these modules and/or feeds when the user was created, so let's try to delete all of them
+      path_set_alias('blog/'. $user->uid);
+      path_set_alias('blog/'. $user->uid .'/feed');
+      path_set_alias('user/'. $user->uid .'/track');
+      path_set_alias('user/'. $user->uid .'/track/feed');
+
+      break;
+    default:
+      break;
+  }
+}
+
+//==============================================================================
+// Admin page related functions.
+
+/**
+ * Form builder; Configure the Pathauto system.
+ *
+ * @ingroup forms
+ * @see system_settings_form()
  */
 function pathauto_admin_settings() {
   _pathauto_include();
@@ -424,126 +742,32 @@ function _pathauto_check_pattern($patter
     }
   }
 
-  if ($return) {
-    $description = t('NOTE: This field contains potentially incorrect patterns. ');
-    $description .= format_plural(count($return), 'Problem token: ', 'Problem tokens: ');
-    $description .= t('%problems', array('%problems' => implode(', ', $return)));
-    $return = $description;
-  }
-
-  return $return;
-}
-
-/**
- * Validate pathauto_admin_settings form submissions.
- */
-function pathauto_admin_settings_validate($form_id, $form_values) {
-  // Validate that the separator is not set to be removed per http://drupal.org/node/184119
-  // This isn't really all that bad so warn, but still allow them to save the value.
-  $separator = $form_values['pathauto_separator'];
-  $punctuation = pathauto_punctuation_chars();
-  foreach ($punctuation as $name => $details) {
-    if ($details['value'] == $separator) {
-      $action = $form_values['pathauto_punctuation_'. $name];
-      if ($action == 0) {
-        drupal_set_message(t('You have configured the @name to be the separator and to be removed when encountered in strings. This can cause problems with your patterns and especially with the catpath and termpath patterns. You should probably set the action for @name to be "replace by separator"', array('@name' => $details['name'])), 'error');
-      }
-    }
-  }
-}
-
-/**
- * Implementation of hook_token_values() for Pathauto specific tokens.
- */
-function pathauto_token_values($type, $object = NULL) {
-  if (module_exists('taxonomy')) {
-    if ($type == 'taxonomy' || $type == 'node' || $type == 'all') {
-      _pathauto_include();
-      switch ($type) {
-        case 'node':
-          $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name", $object->nid, 0, 1));
-          $category = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight", $vid, $object->nid, 0, 1));
-          $category->vid = $vid;
-          // In the realm of nodes these are terms, in the realm of Taxonomy, cats
-          $label = 'term';
-
-          // We're on a node and it's a book and it has a parent? Get the book path alias
-          if (module_exists('book')) {
-            if ($object->type == 'book' && $object->parent) {
-              $values['bookpathalias'] = drupal_get_path_alias('node/'. $object->parent);
-            }
-            else {
-              $values['bookpathalias'] = '';
-            }
-          }
-
-        case 'taxonomy':
-        default:
-          if (!isset($category)) {
-            $category = $object;
-          }
-          if (!isset($label)) {
-            $label = 'cat';
-          }
-          if (isset($category->tid)) {
-            $separator = variable_get('pathauto_separator', '-');
-            $parents = taxonomy_get_parents_all($category->tid);
-            array_shift($parents);
-            $catpath = '';
-            $catpath_raw = '';
-            foreach ($parents as $parent) {
-              // Replace any / characters in individual terms which might create confusing URLs
-              $catpath = pathauto_cleanstring(check_plain(preg_replace('/\//', '', $parent->name))) .'/'. $catpath;
-              $catpath_raw = pathauto_cleanstring(preg_replace('/\//', '', $parent->name)) .'/'. $catpath_raw;
-            }
-            $values[$label .'path'] = $catpath .'/'. check_plain($category->name);
-            $values[$label .'path-raw'] = $catpath_raw .'/'. $category->name;
-
-            // We only do this for taxonomy because token already provides the [term] value but has problem with [cat] TODO: fix that?
-            if ($type == 'taxonomy') {
-              $values[$label] = check_plain($category->name);
-              $values[$label .'-raw'] = $category->name;
-            }
-
-            $values[$label .'alias'] = drupal_get_path_alias('taxonomy/term/'. $category->tid);
-            if (!strncasecmp($values[$label .'alias'], 'taxonomy', 8)) {
-              $values[$label .'alias'] = $values[$label];
-            }
-          }
-          else { // Provide some defaults if they aren't set.
-            $values[$label .'path'] = '';
-            $values[$label .'path-raw'] = '';
-            $values[$label .'alias'] = '';
-          }
-      }
-      return $values;
-    }
+  if ($return) {
+    $description = t('NOTE: This field contains potentially incorrect patterns. ');
+    $description .= format_plural(count($return), 'Problem token: ', 'Problem tokens: ');
+    $description .= t('%problems', array('%problems' => implode(', ', $return)));
+    $return = $description;
   }
+
+  return $return;
 }
 
 /**
- * Implementation of hook_token_list() for Pathauto specific tokens.
+ * Validate pathauto_admin_settings form submissions.
  */
-function pathauto_token_list($type = 'all') {
-  $tokens = array();
-  if (module_exists('taxonomy')) {
-    if ($type == 'taxonomy' || $type == 'all') {
-      $tokens['taxonomy']['catpath'] = t('As [cat], but including its supercategories separated by /.');
-      $tokens['taxonomy']['catpath-raw'] = t('As [cat-raw], but including its supercategories separated by /. WARNING - raw user input.');
-      $tokens['taxonomy']['catalias'] = t('URL alias for the category.');
-    }
-    if ($type == 'node' || $type == 'all') {
-      $tokens['node']['termpath'] = t('As [term], but including its supercategories separated by /.');
-      $tokens['node']['termpath-raw'] = t('As [term-raw], but including its supercategories separated by /. WARNING - raw user input.');
-      $tokens['node']['termalias'] = t('URL alias for the term.');
-    }
-  }
-  if (module_exists('book')) {
-    if ($type == 'node' || $type == 'all') {
-      $tokens['node']['bookpathalias'] = t('URL alias for the parent book.');
+function pathauto_admin_settings_validate($form_id, $form_values) {
+  // Validate that the separator is not set to be removed per http://drupal.org/node/184119
+  // This isn't really all that bad so warn, but still allow them to save the value.
+  $separator = $form_values['pathauto_separator'];
+  $punctuation = pathauto_punctuation_chars();
+  foreach ($punctuation as $name => $details) {
+    if ($details['value'] == $separator) {
+      $action = $form_values['pathauto_punctuation_'. $name];
+      if ($action == 0) {
+        drupal_set_message(t('You have configured the @name to be the separator and to be removed when encountered in strings. This can cause problems with your patterns and especially with the catpath and termpath patterns. You should probably set the action for @name to be "replace by separator"', array('@name' => $details['name'])), 'error');
+      }
     }
   }
-  return $tokens;
 }
 
 /**
@@ -620,221 +844,3 @@ function pathauto_admin_delete_submit($f
   }
   return 'admin/build/path/delete_bulk';
 }
-
-/**
- * Implementation of hook_path_alias_types().
- *
- * Used primarily by the bulk delete form.
- */
-function pathauto_path_alias_types() {
-  $objects = array('user/' => t('users'), 'node/' => t('content'));
-  if (module_exists('blog')) {
-    $objects['blog/'] = t('user blogs');
-  }
-  if (module_exists('taxonomy')) {
-    $objects['taxonomy/'] = t('vocabularies and terms');
-  }
-  if (module_exists('taxonomy')) {
-    $objects['user/%/track'] = t('user trackers');
-  }
-  if (module_exists('forum')) {
-    $objects['forum/%'] = t('forums');
-  }
-
-  return $objects;
-}
-
-//==============================================================================
-// Some node related functions.
-
-/**
- * Implementation of hook_nodeapi().
- */
-function pathauto_nodeapi(&$node, $op, $teaser, $page) {
-  _pathauto_include();
-  if (module_exists('path')) {
-    switch ($op) {
-      case 'insert':
-      case 'update':
-        // Get the specific pattern or the default
-        $pattern = variable_get('pathauto_node_'. $node->type .'_pattern', FALSE);
-        if (!$pattern) {
-          $pattern = variable_get('pathauto_node_pattern', FALSE);
-        }
-        // Only do work if there's a pattern
-        if ($pattern) {
-          // Only create an alias if the checkbox was not provided or if the checkbox was provided and is checked
-          if (!isset($node->pathauto_perform_alias) || $node->pathauto_perform_alias) {
-            $placeholders = pathauto_get_placeholders('node', $node);
-            $src = "node/$node->nid";
-            $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->nid, $node->type);
-          }
-        }
-        break;
-      case 'delete':
-        path_set_alias('node/'. $node->nid);
-        path_set_alias('node/'. $node->nid .'/feed');
-        break;
-      default:
-        break;
-    }
-  }
-}
-
-/**
- * Implementation of hook_form_alter().
- *
- * This allows alias creators to override Pathauto and specify their
- * own aliases (Pathauto will be invisible to other users). Inserted
- * into the path module's fieldset in the node form.
- */
-function pathauto_form_alter($formid, &$form) {
-  // Only do this for node forms
-  if (isset($form['#id']) && ($form['#id'] == 'node-form') && arg(0) == 'node') {
-    // See if there is a pathauto pattern or default applicable
-    $pattern = variable_get('pathauto_node_'. $form['type']['#value'] .'_pattern', FALSE);
-    if (!$pattern) {
-      $pattern = variable_get('pathauto_node_pattern', FALSE);
-    }
-    // If there is a pattern AND the user is allowed to create aliases AND the path textbox is present on this form
-    if ($pattern && user_access('create url aliases') && isset($form['path']['path'])) {
-      $output = t('An alias will be generated for you. If you wish to create your own alias below, untick this option.');
-      if (user_access('administer pathauto')) {
-        $output .= t(' To control the format of the generated aliases, see the <a href="@pathauto">Pathauto settings</a>.', array('@pathauto' => url('admin/settings/pathauto')));
-      }
-
-      drupal_add_js(drupal_get_path('module', 'pathauto') .'/pathauto.js');
-
-      $form['path']['pathauto_perform_alias'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Automatic alias'),
-        '#default_value' => TRUE,
-        '#description' => $output,
-        '#weight' => 0
-      );
-    }
-  }
-}
-
-/**
- * Implementation of hook_node_operations().
- */
-function pathauto_node_operations() {
-  $operations = array(
-    'update_alias' => array(
-      'label' => t('Update path alias'),
-      'callback' => 'pathauto_node_operations_update',
-    ),
-  );
-  return $operations;
-}
-
-/**
- * Callback function for updating node aliases.
- *
- * @param $nodes
- *   Array of node nid's.
- */
-function pathauto_node_operations_update($nodes) {
-  foreach ($nodes as $nid) {
-    $node = node_load($nid);
-    $placeholders = pathauto_get_placeholders('node', $node);
-    pathauto_create_alias('node', 'bulkupdate', $placeholders, "node/$node->nid", $node->nid, $node->type);
-  }
-}
-
-//==============================================================================
-// Taxonomy related functions.
-
-/**
- * Implementation of hook_taxonomy().
- */
-function pathauto_taxonomy($op, $type, $object = NULL) {
-  _pathauto_include();
-  switch ($type) {
-    case 'term':
-      switch ($op) {
-        case 'insert':
-        case 'update':
-          // Use the category info to automatically create an alias
-          $category = (object) $object;
-          if ($category->name) {
-            $count = _taxonomy_pathauto_alias($category, $op);
-          }
-
-          // For all children generate new alias (important if [catpath] used)
-          foreach (taxonomy_get_tree($category->vid, $category->tid) as $subcategory) {
-            $count = _taxonomy_pathauto_alias($subcategory, $op);
-          }
-
-          break;
-        case 'delete':
-          // If the category is deleted, remove the path aliases
-          $category = (object) $object;
-          path_set_alias('taxonomy/term/'. $category->tid);
-          path_set_alias(taxonomy_term_path($category));
-          path_set_alias('forum/'. $category->tid);
-          path_set_alias('taxonomy/term/'. $category->tid .'/0/feed');
-          break;
-        default:
-          break;
-      }
-      break;
-    default:
-      break;
-  }
-}
-
-//==============================================================================
-// User related functions.
-
-/**
- * Implementation of hook_user() for users, trackers, and blogs.
- */
-function pathauto_user($op, &$edit, &$user, $category = FALSE) {
-  _pathauto_include();
-  switch ($op) {
-    case 'insert':
-    case 'update':
-      // Use the username to automatically create an alias
-      $pathauto_user = (object) array_merge((array) $user, $edit);
-      if ($user->name) {
-        $placeholders = pathauto_get_placeholders('user', $pathauto_user);
-        $src = 'user/'. $user->uid;
-        $alias = pathauto_create_alias('user', $op, $placeholders, $src, $user->uid);
-
-        if (module_exists('blog')) {
-          $new_user = $user;
-          $new_user->roles = isset($edit['roles']) ? $edit['roles'] : array();
-          $new_user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user'; // Add this back
-          if (user_access('edit own blog', $new_user)) {
-            $src = 'blog/'. $user->uid;
-            $alias = pathauto_create_alias('blog', $op, $placeholders, $src, $user->uid);
-          }
-          else {
-            path_set_alias('blog/'. $user->uid);
-            path_set_alias('blog/'. $user->uid .'/feed');
-          }
-        }
-        if (module_exists('tracker')) {
-          $src = 'user/'. $user->uid .'/track';
-          $alias = pathauto_create_alias('tracker', $op, $placeholders, $src, $user->uid);
-        }
-      }
-      break;
-    case 'delete':
-      // If the user is deleted, remove the path aliases
-      $user = (object) $user;
-      path_set_alias('user/'. $user->uid);
-
-      // They may have enabled these modules and/or feeds when the user was created, so let's try to delete all of them
-      path_set_alias('blog/'. $user->uid);
-      path_set_alias('blog/'. $user->uid .'/feed');
-      path_set_alias('user/'. $user->uid .'/track');
-      path_set_alias('user/'. $user->uid .'/track/feed');
-
-      break;
-    default:
-      break;
-  }
-}
Index: pathauto_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto_node.inc,v
retrieving revision 1.29.4.30
diff -u -p -r1.29.4.30 pathauto_node.inc
--- pathauto_node.inc	30 May 2008 00:58:55 -0000	1.29.4.30
+++ pathauto_node.inc	1 Jun 2008 13:28:10 -0000
@@ -32,10 +32,9 @@ function node_pathauto($op) {
         }
       }
       $settings['supportsfeeds'] = 'feed';
-      $nodetypes = node_get_types();
-      foreach ($nodetypes as $ntype => $nodetype) {
-        $fieldlabel = t('Pattern for all @node_type paths', array('@node_type' => $nodetype->name));
-        $settings['patternitems'][$ntype] = $fieldlabel;
+      foreach (node_get_types('names') as $node_type => $node_name) {
+        $fieldlabel = t('Pattern for all @node_type paths', array('@node_type' => $node_name));
+        $settings['patternitems'][$node_type] = $fieldlabel;
       }
       return (object) $settings;
     default:
