$sortMapper = array();
foreach ($_GET['columns'] as $key => $value) {
- $sortMapper[$key] = CRM_Utils_Type::escape($value['data'], 'MysqlColumnName');
+ $sortMapper[$key] = CRM_Utils_Type::validate($value['data'], 'MysqlColumnName');
};
$offset = isset($_GET['start']) ? CRM_Utils_Type::validate($_GET['start'], 'Integer') : $defaultOffset;
$sortOrder = isset($_GET['order'][0]['dir']) ? CRM_Utils_Type::validate($_GET['order'][0]['dir'], 'MysqlOrderByDirection') : $defaultsortOrder;
if ($sort) {
- $params['sortBy'] = "`{$sort}` {$sortOrder}";
+ $params['sortBy'] = "{$sort} {$sortOrder}";
$params['_raw_values']['sort'][0] = $sort;
$params['_raw_values']['order'][0] = $sortOrder;
$this->_vars[$this->_currentSortID]['direction'] == self::DONTCARE
) {
$this->_vars[$this->_currentSortID]['name'] = str_replace(' ', '_', $this->_vars[$this->_currentSortID]['name']);
- return CRM_Utils_Type::validate($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnName') . ' asc';
+ return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnName') . ' asc';
}
else {
$this->_vars[$this->_currentSortID]['name'] = str_replace(' ', '_', $this->_vars[$this->_currentSortID]['name']);
- return CRM_Utils_Type::validate($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnName') . ' desc';
+ return CRM_Utils_Type::escape($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnName') . ' desc';
}
}