303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
if (!$champs->get($field))
{
throw new \UnexpectedValueException($field . ' is not a valid field');
}
$champ = $champs->get($field);
if ($champ['type'] == 'multiple')
{
$where = 'WHERE '.$field.' & (1 << '.(int)$query.')';
$order = false;
}
elseif ($champ['type'] == 'tel')
{
$query = Utils::normalizePhoneNumber($query);
$query = preg_replace('!^0+!', '', $query);
if ($query == '')
{
return false;
|
|
|
|
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
if (!$champs->get($field))
{
throw new \UnexpectedValueException($field . ' is not a valid field');
}
$champ = $champs->get($field);
if ($champ->type == 'multiple')
{
$where = 'WHERE '.$field.' & (1 << '.(int)$query.')';
$order = false;
}
elseif ($champ->type == 'tel')
{
$query = Utils::normalizePhoneNumber($query);
$query = preg_replace('!^0+!', '', $query);
if ($query == '')
{
return false;
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
}
else
{
$where = sprintf('WHERE transliterate_to_ascii(%s) LIKE %s', $field, $db->quote('%' . Utils::transliterateToAscii($query) . '%'));
$order = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE', $field);
}
$fields = array_keys($champs->getListedFields());
if (!in_array($field, $fields))
{
$fields[] = $field;
}
if (!in_array('email', $fields))
|
|
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
}
else
{
$where = sprintf('WHERE transliterate_to_ascii(%s) LIKE %s', $field, $db->quote('%' . Utils::transliterateToAscii($query) . '%'));
$order = sprintf('transliterate_to_ascii(%s) COLLATE NOCASE', $field);
}
$fields = array_keys((array)$champs->getListedFields());
if (!in_array($field, $fields))
{
$fields[] = $field;
}
if (!in_array('email', $fields))
|