$_GET['input'] = base64_decode($_GET['input']); } $sData = base64_decode(str_rot13($_GET['hash'])); list($SQL, $DB_UID) = explode('@|', $sData); // Remplace values for dependent fields $aDependentFieldsKeys = explode("|", base64_decode(str_rot13($_GET['dependentFieldsKeys']))); $aDependentFieldsValue = explode("|", $_GET['dependentFieldsValue']); if ($aDependentFieldsKeys) { $SQL = str_replace($aDependentFieldsKeys, $aDependentFieldsValue, $SQL); } // Parsed SQL Structure G::LoadClass('phpSqlParser'); $parser = new PHPSQLParser($SQL); // Verif parsed array // print_r($parser->parsed); $SQL = queryModified($parser->parsed, $_GET['input']); $aRows = array(); try { $con = Propel::getConnection($DB_UID); $con->begin(); $rs = $con->executeQuery($SQL); $con->commit(); while ($rs->next()) { array_push($aRows, $rs->getRow()); } } catch (SQLException $sqle) { $con->rollback(); } $input = strtolower($_GET['input']); $len = strlen($input); $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 0;
$aDependentFieldsValue = explode("|", $_GET['dependentFieldsValue']); if ($aDependentFieldsKeys) { $aDependentFields = array(); foreach ($aDependentFieldsKeys as $nKey => $sFieldVar) { $sKeyDepFields = substr($sFieldVar, 2); $aDependentFields[$sKeyDepFields] = $aDependentFieldsValue[$nKey]; } $SQL = G::replaceDataField($SQL, $aDependentFields); } // Parsed SQL Structure G::LoadClass('phpSqlParser'); $parser = new PHPSQLParser($SQL); $searchType = $_GET["searchType"]; // Verif parsed array // print_r($parser->parsed); $SQL = queryModified($parser->parsed, $_GET['input'], $searchType); $aRows = array(); try { $con = Propel::getConnection($DB_UID); $con->begin(); $rs = $con->executeQuery($SQL); $con->commit(); while ($rs->next()) { array_push($aRows, $rs->getRow()); } } catch (SQLException $sqle) { $con->rollback(); } $input = strtolower($_GET['input']); $len = strlen($input); $limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 0;