aboutsummaryrefslogtreecommitdiff
path: root/actions/user/name.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-26 17:10:26 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-26 17:10:26 +0000
commit1758a7093b49425f4f79467a9b10c24332628f09 (patch)
tree4168c1c01bcef2d38acc3dc52ad5b72b8e6bc267 /actions/user/name.php
parent0b2d26d53874abbb83a776c234507949bd3de947 (diff)
downloadelgg-1758a7093b49425f4f79467a9b10c24332628f09.tar.gz
elgg-1758a7093b49425f4f79467a9b10c24332628f09.tar.bz2
Display names are limited to 50 chars and have HTML tags removed.
git-svn-id: http://code.elgg.org/elgg/trunk@3845 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/user/name.php')
-rw-r--r--actions/user/name.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/actions/user/name.php b/actions/user/name.php
index bc14d3184..3145c5ee7 100644
--- a/actions/user/name.php
+++ b/actions/user/name.php
@@ -12,7 +12,7 @@ global $CONFIG;
gatekeeper();
-$name = get_input('name');
+$name = strip_tags(get_input('name'));
$user_id = get_input('guid');
$user = "";
@@ -22,8 +22,13 @@ if (!$user_id) {
$user = get_entity($user_id);
}
-if (($user) && ($name)) {
- if (strcmp($name, $user->name)!=0) {
+if (elgg_strlen($name) > 50) {
+ register_error(elgg_echo('user:name:fail'));
+ forward($_SERVER['HTTP_REFERER']);
+}
+
+if (($user) && ($user->canEdit()) && ($name)) {
+ if ($name != $user->name) {
$user->name = $name;
if ($user->save()) {
system_message(elgg_echo('user:name:success'));