Révision 30d5b9c5
Ajouté par Mathieu Schiano Di Schiabica il y a environ 8 ans
drupal7/modules/user/user.module | ||
---|---|---|
958 | 958 |
*/ |
959 | 959 |
function user_search_execute($keys = NULL, $conditions = NULL) { |
960 | 960 |
$find = array(); |
961 |
// Escape for LIKE matching. |
|
962 |
$keys = db_like($keys); |
|
961 | 963 |
// Replace wildcards with MySQL/PostgreSQL wildcards. |
962 | 964 |
$keys = preg_replace('!\*+!', '%', $keys); |
963 | 965 |
$query = db_select('users')->extend('PagerDefault'); |
... | ... | |
967 | 969 |
// and they don't need to be restricted to only active users. |
968 | 970 |
$query->fields('users', array('mail')); |
969 | 971 |
$query->condition(db_or()-> |
970 |
condition('name', '%' . db_like($keys) . '%', 'LIKE')->
|
|
971 |
condition('mail', '%' . db_like($keys) . '%', 'LIKE'));
|
|
972 |
condition('name', '%' . $keys . '%', 'LIKE')->
|
|
973 |
condition('mail', '%' . $keys . '%', 'LIKE'));
|
|
972 | 974 |
} |
973 | 975 |
else { |
974 | 976 |
// Regular users can only search via usernames, and we do not show them |
975 | 977 |
// blocked accounts. |
976 |
$query->condition('name', '%' . db_like($keys) . '%', 'LIKE')
|
|
978 |
$query->condition('name', '%' . $keys . '%', 'LIKE')
|
|
977 | 979 |
->condition('status', 1); |
978 | 980 |
} |
979 | 981 |
$uids = $query |
... | ... | |
3663 | 3665 |
); |
3664 | 3666 |
|
3665 | 3667 |
$element['#attached']['js'][] = drupal_get_path('module', 'user') . '/user.js'; |
3666 |
// Ensure settings are only added once per page. |
|
3667 |
static $already_added = FALSE; |
|
3668 |
if (!$already_added) { |
|
3669 |
$already_added = TRUE; |
|
3670 |
$element['#attached']['js'][] = array('data' => $js_settings, 'type' => 'setting'); |
|
3671 |
} |
|
3668 |
$element['#attached']['js'][] = array('data' => $js_settings, 'type' => 'setting'); |
|
3672 | 3669 |
|
3673 | 3670 |
return $element; |
3674 | 3671 |
} |
Formats disponibles : Unified diff
Update to 7.42