? alias_extra_removal.patch ? better_alias_protection.patch ? better_alias_protection_201659.patch ? i18n-ascii.txt ? leave_patterns_alone_on_variable_get_106296.patch ? message ? new-lr-quotes.patch ? path_set_alias_3_args_218552.patch ? pathauto.inc__3.patch ? pathauto_bulk_delete.patch ? pathauto_js_only_necessary_208820.patch ? pathauto_pgsql_install_195044.patch ? pathauto_user_access_denied_secure_193733.patch ? support_node_feeds_again_216245.patch ? whole_shebang.patch Index: pathauto.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v retrieving revision 1.1.2.29 diff -u -p -r1.1.2.29 pathauto.inc --- pathauto.inc 6 Feb 2008 17:42:52 -0000 1.1.2.29 +++ pathauto.inc 13 Feb 2008 12:19:17 -0000 @@ -354,13 +354,6 @@ function _pathauto_set_alias($src, $dst, // Skip replacing the current alias with an identical alias if ($old_alias != $dst) { path_set_alias($src, $dst, $pid); - $new_pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE src = '%s' and dst = '%s'", $src, $dst)); - if ($new_pid != $pid) { - db_query("INSERT INTO {url_alias_extra} (pid, dst, entity_type, entity_id, created_by) VALUES (%d, '%s', '%s', %d, '%s')", $new_pid, $dst, $entity_type, $entity_id, 'Pathauto'); - } - else { - db_query("UPDATE {url_alias_extra} SET dst = '%s', entity_type = '%s', entity_id = %d, created_by = '%s' WHERE pid = %d", $dst, $entity_type, $entity_id, 'Pathauto', $pid); - } if (variable_get('pathauto_update_action', 2) == 3 && function_exists('path_redirect_save')) { if (isset($old_alias)) { Index: pathauto.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.module,v retrieving revision 1.44.4.74 diff -u -p -r1.44.4.74 pathauto.module --- pathauto.module 3 Feb 2008 12:31:32 -0000 1.44.4.74 +++ pathauto.module 13 Feb 2008 12:19:19 -0000 @@ -509,12 +509,6 @@ function pathauto_admin_delete() { '#default_value' => FALSE, '#description' => t('Delete all aliases. Number of aliases which will be deleted: %count.', array('%count' => $total_count))); - $total_count = db_result(db_query("SELECT count(1) FROM {url_alias} ua INNER JOIN {url_alias_extra} uax ON ua.pid = uax.pid AND ua.dst = uax.dst")); - $form['delete']['all_pathauto_aliases'] = array('#type' => 'checkbox', - '#title' => t('all Pathauto aliases'), - '#default_value' => FALSE, - '#description' => t('Delete aliases created by Pathauto 5.x-2.1 or higher. Number of aliases which will be deleted: %count.', array('%count' => $total_count))); - // Next, iterate over an array of objects/alias types which can be deleted and provide checkboxes $objects = module_invoke_all('path_alias_types'); foreach ($objects as $internal_name => $label) { @@ -545,10 +539,6 @@ function pathauto_admin_delete_submit($f db_query('DELETE FROM {url_alias}'); drupal_set_message(t('All of your path aliases have been deleted.')); } - if ($key === 'all_pathauto_aliases') { - db_query('DELETE {url_alias} ua, {url_alias_extra} uax FROM {url_alias} ua INNER JOIN {url_alias_extra} uax on ua.pid = uax.pid and ua.dst = uax.dst'); - drupal_set_message(t('All of your path aliases have been deleted.')); - } $objects = module_invoke_all('path_alias_types'); if (array_key_exists($key, $objects)) { db_query("DELETE FROM {url_alias} WHERE src LIKE '%s%%'", $key); @@ -575,26 +565,20 @@ function pathauto_nodeapi(&$node, $op, $ switch ($op) { case 'insert': case 'update': - // If the box is checked we should alias it - // If the box is not checked but it's already being managed by Pathauto we should alias it - // If the box is not checked, it's not being managed by Pathauto, but this is the submit, we should do it - if ($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); - } - else if (db_result(db_query("SELECT pid FROM {url_alias_extra} WHERE dst = '%s' AND created_by = 'Pathauto'", drupal_get_path_alias($node->nid)))) { - // it's an existing node and Pathauto currently controls the alias for it - dsm('doing update for non admin user'); - $placeholders = pathauto_get_placeholders('node', $node); - $src = "node/$node->nid"; - $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->nid, $node->type); + // 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); } - else if (!user_access('ceate url aliases') && $op == 'insert') { - // It's a user who won't be able to create their own and it's an insert - $placeholders = pathauto_get_placeholders('node', $node); - $src = "node/$node->nid"; - $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->nid, $node->type); + // Only do work if there's a pattern + if ($pattern) { + // If the box is checked we should alias it + // If the box is not checked, but the user doesn't have the perms on the box we should alias it + if ($node->pathauto_perform_alias || !user_access('ceate url aliases')) { + $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': @@ -615,21 +599,14 @@ function pathauto_nodeapi(&$node, $op, $ * 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')) { + // 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); } - $path = $form['path']['path']['#default_value']; - if(strlen($path)) { - $pathauto_alias = db_result(db_query("SELECT pid FROM {url_alias_extra} WHERE dst = '%s'", $path)); - } - else if ($form['nid']['#value']) { - $pathauto_alias = FALSE; - } - else { - $pathauto_alias = TRUE; - } + // 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')) { @@ -640,7 +617,7 @@ function pathauto_form_alter($formid, &$ $form['path']['pathauto_perform_alias'] = array('#type' => 'checkbox', '#title' => t('Automatic alias'), - '#default_value' => $pathauto_alias, + '#default_value' => TRUE, '#description' => $output, '#weight' => 0 );