foreach ($vars as $weight => $value) {
$this->_vars[$weight] = array(
- 'name' => $value['sort'],
+ 'name' => CRM_Utils_Type::validate($value['sort'], 'MysqlColumnName'),
'direction' => CRM_Utils_Array::value('direction', $value),
'title' => $value['name'],
);
$this->_vars[$this->_currentSortID]['direction'] == self::DONTCARE
) {
$this->_vars[$this->_currentSortID]['name'] = str_replace(' ', '_', $this->_vars[$this->_currentSortID]['name']);
- return $this->_vars[$this->_currentSortID]['name'] . ' asc';
+ return CRM_Utils_Type::validate($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnName') . ' asc';
}
else {
$this->_vars[$this->_currentSortID]['name'] = str_replace(' ', '_', $this->_vars[$this->_currentSortID]['name']);
- return $this->_vars[$this->_currentSortID]['name'] . ' desc';
+ return CRM_Utils_Type::validate($this->_vars[$this->_currentSortID]['name'], 'MysqlColumnName') . ' desc';
}
}