HOR-4751
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
parent
a24e057b23
commit
548e953072
@@ -356,12 +356,26 @@ class InputFilter
|
||||
* @param String $source
|
||||
* @param Resource $connection - An open MySQL connection
|
||||
* @return String $source
|
||||
* @todo We need to review this method, because the sended string is unescaped
|
||||
*/
|
||||
public function escapeString($string, &$connection)
|
||||
{
|
||||
return mysqli_real_escape_string($connection, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a string using a Propel connection
|
||||
*
|
||||
* @param string $string The string to escapes
|
||||
* @param object $connection The connection object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function escapeUsingConnection($string, $connection)
|
||||
{
|
||||
return mysqli_real_escape_string($connection->getResource(), $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method removes tags/special characters
|
||||
* @author Marcelo Cuiza
|
||||
|
||||
@@ -43,6 +43,23 @@ class Applications
|
||||
|
||||
//Start the connection to database
|
||||
$con = Propel::getConnection(AppDelegationPeer::DATABASE_NAME);
|
||||
|
||||
//Sanitize input variables
|
||||
$inputFilter = new InputFilter();
|
||||
$userUid = $inputFilter->validateInput($userUid, 'int');
|
||||
$start = $inputFilter->validateInput($start, 'int');
|
||||
$limit = $inputFilter->validateInput($limit, 'int');
|
||||
$search = $inputFilter->escapeUsingConnection($search, $con);
|
||||
$process = $inputFilter->validateInput($process, 'int');
|
||||
//$status doesn't require sanitization
|
||||
$dir = in_array($dir, ['ASC', 'DESC']) ? $dir :'DESC';
|
||||
$sort = $inputFilter->escapeUsingConnection($sort, $con);
|
||||
$category = $inputFilter->escapeUsingConnection($category, $con);
|
||||
$dateFrom = $inputFilter->escapeUsingConnection($dateFrom, $con);
|
||||
$dateTo = $inputFilter->escapeUsingConnection($dateTo, $con);
|
||||
$columnSearch = $inputFilter->escapeUsingConnection($columnSearch, $con);
|
||||
|
||||
//Start the transaction
|
||||
$con->begin();
|
||||
$stmt = $con->createStatement();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user