HOR-281 No longer assumes mysql for escaping.
This commit is contained in:
@@ -178,15 +178,10 @@ if( isset($request) ){
|
|||||||
try {
|
try {
|
||||||
$con = Propel::getConnection($_GET['cnn']);
|
$con = Propel::getConnection($_GET['cnn']);
|
||||||
if($_GET['pkt'] == 'int'){
|
if($_GET['pkt'] == 'int'){
|
||||||
// I know this isn't perfect
|
|
||||||
// but this is the sanitization
|
$primaryKeyField = Propel::getDB($_GET['cnn'])->quoteIdentifier($_GET['pk']);
|
||||||
// that's used by Creole.
|
$tableName = Propel::getDB($_GET['cnn'])->quoteIdentifier($_GET['table']);
|
||||||
|
$rs = $con->executeQuery("SELECT MAX($primaryKeyField) as lastId FROM $tableName");
|
||||||
$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`");
|
|
||||||
$rs->next();
|
$rs->next();
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
$gKey = (int)$row['lastId'] + 1;
|
$gKey = (int)$row['lastId'] + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user