|
@@ -1172,7 +1172,9 @@ function MessageSearch2()
|
|
|
foreach ($possible_users as $k => $v)
|
|
|
{
|
|
|
$where_params['name_' . $k] = $v;
|
|
|
- $where_clause[] = 'real_name LIKE {string:name_' . $k . '}';
|
|
|
+ $where_clause[] = '{raw:real_name} LIKE {string:name_' . $k . '}';
|
|
|
+ if (!isset($where_params['real_name']))
|
|
|
+ $where_params['real_name'] = $smcFunc['db_case_sensitive'] ? 'LOWER(real_name)' : 'real_name';
|
|
|
}
|
|
|
|
|
|
// Who matches those criteria?
|
|
@@ -1189,17 +1191,19 @@ function MessageSearch2()
|
|
|
$userQuery = '';
|
|
|
elseif ($smcFunc['db_num_rows']($request) == 0)
|
|
|
{
|
|
|
- $userQuery = 'AND pm.id_member_from = 0 AND (pm.from_name LIKE {raw:guest_user_name_implode})';
|
|
|
- $searchq_parameters['guest_user_name_implode'] = '\'' . implode('\' OR pm.from_name LIKE \'', $possible_users) . '\'';
|
|
|
+ $userQuery = 'AND pm.id_member_from = 0 AND ({raw:pm_from_name} LIKE {raw:guest_user_name_implode})';
|
|
|
+ $searchq_parameters['guest_user_name_implode'] = '\'' . implode('\' OR ' . ($smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name') . ' LIKE \'', $possible_users) . '\'';
|
|
|
+ $searchq_parameters['pm_from_name'] = $smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name';
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
$memberlist = array();
|
|
|
while ($row = $smcFunc['db_fetch_assoc']($request))
|
|
|
$memberlist[] = $row['id_member'];
|
|
|
- $userQuery = 'AND (pm.id_member_from IN ({array_int:member_list}) OR (pm.id_member_from = 0 AND (pm.from_name LIKE {raw:guest_user_name_implode})))';
|
|
|
- $searchq_parameters['guest_user_name_implode'] = '\'' . implode('\' OR pm.from_name LIKE \'', $possible_users) . '\'';
|
|
|
+ $userQuery = 'AND (pm.id_member_from IN ({array_int:member_list}) OR (pm.id_member_from = 0 AND ({raw:pm_from_name} LIKE {raw:guest_user_name_implode})))';
|
|
|
+ $searchq_parameters['guest_user_name_implode'] = '\'' . implode('\' OR ' . ($smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name') . ' LIKE \'', $possible_users) . '\'';
|
|
|
$searchq_parameters['member_list'] = $memberlist;
|
|
|
+ $searchq_parameters['pm_from_name'] = $smcFunc['db_case_sensitive'] ? 'LOWER(pm.from_name)' : 'pm.from_name';
|
|
|
}
|
|
|
$smcFunc['db_free_result']($request);
|
|
|
}
|