HOR-281 No longer assumes mysql for escaping.

This commit is contained in:
Chloe Deguzman
2016-03-21 22:25:04 +00:00
parent f9ca5867e4
commit 58b80f54a1

View File

@@ -178,15 +178,10 @@ if( isset($request) ){
try {
$con = Propel::getConnection($_GET['cnn']);
if($_GET['pkt'] == 'int'){
// I know this isn't perfect
// but this is the sanitization
// that's used by Creole.
$primaryKeyField = mysql_real_escape_string($_GET['pk']);
$tableName = mysql_real_escape_string($_GET['table']);
$primaryKeyField = str_replace("`", "", $primaryKeyField);
$tableName = str_replace("`", "", $tableName);
$rs = $con->executeQuery("SELECT MAX(`$primaryKeyField`) as lastId FROM `$tableName`");
$primaryKeyField = Propel::getDB($_GET['cnn'])->quoteIdentifier($_GET['pk']);
$tableName = Propel::getDB($_GET['cnn'])->quoteIdentifier($_GET['table']);
$rs = $con->executeQuery("SELECT MAX($primaryKeyField) as lastId FROM $tableName");
$rs->next();
$row = $rs->getRow();
$gKey = (int)$row['lastId'] + 1;