diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-10 12:08:22 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-10 12:08:22 +0000 |
commit | 480c53b6dbcabba5dca76cfc24e1c284cff75c4c (patch) | |
tree | 8fabf241a251fea183f522b759f1b0df1af80b2d /modules/path/path.module | |
parent | ecf6c8de03e303e4da1bad39450483528ca136fd (diff) | |
download | brdo-480c53b6dbcabba5dca76cfc24e1c284cff75c4c.tar.gz brdo-480c53b6dbcabba5dca76cfc24e1c284cff75c4c.tar.bz2 |
#154517 by chx and Desbeers: usability fixes for path module (required fields, permission info and resetting the filter made possible), and fixing language usage on nodeapi update in path_nodeapi
Diffstat (limited to 'modules/path/path.module')
-rw-r--r-- | modules/path/path.module | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/path/path.module b/modules/path/path.module index 76f81907c..f624eb787 100644 --- a/modules/path/path.module +++ b/modules/path/path.module @@ -139,18 +139,17 @@ function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = '' */ function path_nodeapi(&$node, $op, $arg) { if (user_access('create url aliases') || user_access('administer url aliases')) { + $language = isset($node->language) ? $node->language : ''; switch ($op) { case 'validate': $node->path = trim($node->path); - $language = isset($node->language) ? $node->language : ''; if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s' AND language = '%s'", $node->path, "node/$node->nid", $language))) { form_set_error('path', t('The path is already in use.')); } break; case 'load': - $path = "node/$node->nid"; - $language = isset($node->language) ? $node->language : ''; + $path = 'node/'. $node->nid; $alias = drupal_get_path_alias($path, $language); if ($path != $alias) { $node->path = $alias; @@ -161,16 +160,16 @@ function path_nodeapi(&$node, $op, $arg) { // Don't try to insert if path is NULL. We may have already set // the alias ahead of time. if (isset($node->path)) { - path_set_alias("node/$node->nid", $node->path); + path_set_alias('node/'. $node->nid, $node->path); } break; case 'update': - path_set_alias("node/$node->nid", isset($node->path) ? $node->path : NULL, isset($node->pid) ? $node->pid : NULL); + path_set_alias('node/'. $node->nid, isset($node->path) ? $node->path : NULL, isset($node->pid) ? $node->pid : NULL, $language); break; case 'delete': - $path = "node/$node->nid"; + $path = 'node/'. $node->nid; if (drupal_get_path_alias($path) != $path) { path_set_alias($path); } |