Allow for backticks in sort column

This commit is contained in:
Isaac Connor 2020-05-11 08:34:07 -04:00
parent 3d278eddf8
commit d23258cb23
1 changed files with 1 additions and 1 deletions

View File

@ -283,7 +283,7 @@ function collectData() {
$sort_fields = explode(',',$_REQUEST['sort']); $sort_fields = explode(',',$_REQUEST['sort']);
foreach ( $sort_fields as $sort_field ) { foreach ( $sort_fields as $sort_field ) {
preg_match('/^(\w+)\s*(ASC|DESC)?( NULLS FIRST)?$/i', $sort_field, $matches); preg_match('/^`?(\w+)`?\s*(ASC|DESC)?( NULLS FIRST)?$/i', $sort_field, $matches);
if ( count($matches) ) { if ( count($matches) ) {
if ( in_array($matches[1], $fieldSql) ) { if ( in_array($matches[1], $fieldSql) ) {
$sql .= $matches[1]; $sql .= $matches[1];