summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/path.module11
-rw-r--r--modules/path/path.module11
-rw-r--r--modules/profile.module12
-rw-r--r--modules/profile/profile.module12
-rw-r--r--modules/user.module8
-rw-r--r--modules/user/user.module8
6 files changed, 38 insertions, 24 deletions
diff --git a/modules/path.module b/modules/path.module
index 5ac3cc982..d72c56690 100644
--- a/modules/path.module
+++ b/modules/path.module
@@ -175,7 +175,11 @@ function path_nodeapi(&$node, $op, $arg) {
// viewing of the form. If it is the first time, load the alias, if it isn't
// (i.e., user has clicked preview) let them work with their current form alias.
if (is_null($node->path)) {
- $node->path = drupal_get_path_alias("node/view/$node->nid");
+ $path = "node/view/$node->nid";
+ $alias = drupal_get_path_alias($path);
+ if ($alias != $path) {
+ $node->path = $alias;
+ }
}
else {
$node->path = trim($node->path);
@@ -205,8 +209,9 @@ function path_nodeapi(&$node, $op, $arg) {
break;
case 'delete':
- if ($alias = drupal_get_path_alias("node/view/$node->nid")) {
- path_set_alias("node/view/$node->nid");
+ $path = "node/view/$node->nid";
+ if (drupal_get_path_alias($path) != $path) {
+ path_set_alias($path);
}
break;
}
diff --git a/modules/path/path.module b/modules/path/path.module
index 5ac3cc982..d72c56690 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -175,7 +175,11 @@ function path_nodeapi(&$node, $op, $arg) {
// viewing of the form. If it is the first time, load the alias, if it isn't
// (i.e., user has clicked preview) let them work with their current form alias.
if (is_null($node->path)) {
- $node->path = drupal_get_path_alias("node/view/$node->nid");
+ $path = "node/view/$node->nid";
+ $alias = drupal_get_path_alias($path);
+ if ($alias != $path) {
+ $node->path = $alias;
+ }
}
else {
$node->path = trim($node->path);
@@ -205,8 +209,9 @@ function path_nodeapi(&$node, $op, $arg) {
break;
case 'delete':
- if ($alias = drupal_get_path_alias("node/view/$node->nid")) {
- path_set_alias("node/view/$node->nid");
+ $path = "node/view/$node->nid";
+ if (drupal_get_path_alias($path) != $path) {
+ path_set_alias($path);
}
break;
}
diff --git a/modules/profile.module b/modules/profile.module
index eef0f93a2..9663342d3 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -30,11 +30,13 @@ function profile_link($type) {
function profile_browse() {
+ $name = strip_tags(arg(1));
+ $value = strip_tags(arg(2));
- $field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page FROM {profile_fields} WHERE name = '%s'", arg(1)));
+ $field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page FROM {profile_fields} WHERE name = '%s'", $name));
if ($field->fid) {
- // Compile a list of fields to show:
+ // Compile a list of fields to show
$fields = array();
$result = db_query("SELECT name, title, type FROM {profile_fields} WHERE fid != %d AND overview = 1", $field->fid);
while ($record = db_fetch_object($result)) {
@@ -47,10 +49,10 @@ function profile_browse() {
$query = 'v.value = 1';
break;
case 'selection':
- $query = "v.value = '". check_query(arg(2)) ."'";
+ $query = "v.value = '". check_query($value) ."'";
break;
case 'list':
- $query = "v.value LIKE '%". check_query(arg(2)) ."%'";
+ $query = "v.value LIKE '%". check_query($value) ."%'";
break;
}
@@ -64,7 +66,7 @@ function profile_browse() {
$output .= theme('pager', NULL, 20);
if ($field->type == 'selection' || $field->type == 'list') {
- $title = strtr($field->page, array('%value' => arg(2)));
+ $title = strtr($field->page, array('%value' => $value));
}
else {
$title = $field->page;
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index eef0f93a2..9663342d3 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -30,11 +30,13 @@ function profile_link($type) {
function profile_browse() {
+ $name = strip_tags(arg(1));
+ $value = strip_tags(arg(2));
- $field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page FROM {profile_fields} WHERE name = '%s'", arg(1)));
+ $field = db_fetch_object(db_query("SELECT DISTINCT(fid), type, title, page FROM {profile_fields} WHERE name = '%s'", $name));
if ($field->fid) {
- // Compile a list of fields to show:
+ // Compile a list of fields to show
$fields = array();
$result = db_query("SELECT name, title, type FROM {profile_fields} WHERE fid != %d AND overview = 1", $field->fid);
while ($record = db_fetch_object($result)) {
@@ -47,10 +49,10 @@ function profile_browse() {
$query = 'v.value = 1';
break;
case 'selection':
- $query = "v.value = '". check_query(arg(2)) ."'";
+ $query = "v.value = '". check_query($value) ."'";
break;
case 'list':
- $query = "v.value LIKE '%". check_query(arg(2)) ."%'";
+ $query = "v.value LIKE '%". check_query($value) ."%'";
break;
}
@@ -64,7 +66,7 @@ function profile_browse() {
$output .= theme('pager', NULL, 20);
if ($field->type == 'selection' || $field->type == 'list') {
- $title = strtr($field->page, array('%value' => arg(2)));
+ $title = strtr($field->page, array('%value' => $value));
}
else {
$title = $field->page;
diff --git a/modules/user.module b/modules/user.module
index f28a5ee99..1d5551eec 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -903,18 +903,18 @@ function user_register($edit = array()) {
}
}
}
-
+
if (!form_has_errors()) {
$from = variable_get('site_mail', ini_get('sendmail_from'));
$pass = user_password();
-
+
// TODO: Is this necessary? Won't session_write() replicate this?
unset($edit['session']);
$account = user_save('', array_merge(array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'rid' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)), $data));
watchdog('user', 'new user: "'. $edit['name'] .'" <'. $edit['mail'] .'>', l(t('edit user'), "admin/user/edit/$account->uid"));
-
+
$variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user/login', NULL, NULL, TRUE), '%edit_uri' => url('user/edit', NULL, NULL, TRUE));
-
+
// The first user may login immediately, and receives a customized welcome e-mail.
if ($account->uid == 1) {
user_mail($edit['mail'], t('drupal user account details for %s', array('%s' => $edit['name'])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
diff --git a/modules/user/user.module b/modules/user/user.module
index f28a5ee99..1d5551eec 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -903,18 +903,18 @@ function user_register($edit = array()) {
}
}
}
-
+
if (!form_has_errors()) {
$from = variable_get('site_mail', ini_get('sendmail_from'));
$pass = user_password();
-
+
// TODO: Is this necessary? Won't session_write() replicate this?
unset($edit['session']);
$account = user_save('', array_merge(array('name' => $edit['name'], 'pass' => $pass, 'init' => $edit['mail'], 'mail' => $edit['mail'], 'rid' => array(_user_authenticated_id()), 'status' => (variable_get('user_register', 1) == 1 ? 1 : 0)), $data));
watchdog('user', 'new user: "'. $edit['name'] .'" <'. $edit['mail'] .'>', l(t('edit user'), "admin/user/edit/$account->uid"));
-
+
$variables = array('%username' => $edit['name'], '%site' => variable_get('site_name', 'drupal'), '%password' => $pass, '%uri' => $base_url, '%uri_brief' => substr($base_url, strlen('http://')), '%mailto' => $edit['mail'], '%date' => format_date(time()), '%login_uri' => url('user/login', NULL, NULL, TRUE), '%edit_uri' => url('user/edit', NULL, NULL, TRUE));
-
+
// The first user may login immediately, and receives a customized welcome e-mail.
if ($account->uid == 1) {
user_mail($edit['mail'], t('drupal user account details for %s', array('%s' => $edit['name'])), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n username: %username\n password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");