//
// MySQL permits column names that don't match this (eg containing spaces),
// but CiviCRM won't create those ...
- if (!preg_match('/^[\w_]+(\.[\w_]+)?$/i', $str)) {
+ if (!preg_match('/^[\w]+(\.[\w]+)?$/i', $str)) {
return FALSE;
}
// at all, so we split and loop over.
$parts = explode(',', $str);
foreach ($parts as $part) {
- if (!preg_match('/^(([\w_]+)((\.)([\w_]+))?( (asc|desc))?)$/i', trim($part))) {
+ if (!preg_match('/^(([\w]+)((\.)([\w]+))?( (asc|desc))?)$/i', trim($part))) {
return FALSE;
}
}
if (CRM_Utils_Rule::mysqlOrderBy($data)) {
$parts = explode(',', $data);
foreach ($parts as &$part) {
- $part = preg_replace_callback('/(?:([\w_]+)(?:(?:\.)([\w_]+))?(?: (asc|desc))?)/i', array('CRM_Utils_Type', 'mysqlOrderByCallback'), trim($part));
+ $part = preg_replace_callback('/(?:([\w]+)(?:(?:\.)([\w]+))?(?: (asc|desc))?)/i', array('CRM_Utils_Type', 'mysqlOrderByCallback'), trim($part));
}
return implode(', ', $parts);
}