diff options
author | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-06-10 14:46:48 +0000 |
---|---|---|
committer | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-06-10 14:46:48 +0000 |
commit | da127e1bc7bb7fe58daabd06ce2aad1163cd7ef1 (patch) | |
tree | 218ca7ca497c96a4e05230fc3cc0d546889fa497 /views/default/input | |
parent | f5f165a3532057d8a2a9016af404bd84f8da730a (diff) | |
download | elgg-da127e1bc7bb7fe58daabd06ce2aad1163cd7ef1.tar.gz elgg-da127e1bc7bb7fe58daabd06ce2aad1163cd7ef1.tar.bz2 |
Performing checks to handle empty arrays and malformed values.
git-svn-id: http://code.elgg.org/elgg/trunk@6440 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/input')
-rw-r--r-- | views/default/input/userpicker.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/views/default/input/userpicker.php b/views/default/input/userpicker.php index 001090729..75186c948 100644 --- a/views/default/input/userpicker.php +++ b/views/default/input/userpicker.php @@ -24,6 +24,10 @@ global $user_picker_js_sent; function user_picker_add_user($user_id) { $user = get_entity($user_id); + if (!$user || !($user instanceof ElggUser)) { + return FALSE; + } + $icon = $user->getIcon('tiny'); $code = '<li class="user_picker_entry">'; @@ -43,6 +47,7 @@ if (!isset($vars['value']) || $vars['value'] === FALSE) { } // loop over all values and prepare them so that "in" will work in javascript +$values = array(); if (!is_array($vars['value'])) { $vars['value'] = array($vars['value']); } @@ -133,7 +138,7 @@ function userPickerAddUser(event, data, formatted) { // do not allow users to be added multiple times if (!(info.guid in userList)) { - userList.push(info.guid); + userList[info.guid] = true; var picker = $(this).parent('.user_picker'); var users = picker.find('.users'); |