From bf9ffedefd393fed7c67fcec7d9f835603326ffa Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Tue, 29 Jul 2014 09:36:03 +0200 Subject: [PATCH] =?UTF-8?q?Readd=20real=5Fescape=20method=20for=20addI18nC?= =?UTF-8?q?ondition=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/?= =?UTF-8?q?Thelia/ImportExport/Export/ExportHandler.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImportExport/Export/ExportHandler.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/core/lib/Thelia/ImportExport/Export/ExportHandler.php b/core/lib/Thelia/ImportExport/Export/ExportHandler.php index f7201fc36..e051cbf57 100644 --- a/core/lib/Thelia/ImportExport/Export/ExportHandler.php +++ b/core/lib/Thelia/ImportExport/Export/ExportHandler.php @@ -150,6 +150,33 @@ abstract class ExportHandler extends AbstractHandler ; } + /** + * @param $str + * @return string + * + * Really escapes a string for SQL request. + */ + protected function real_escape($str) + { + $str = trim($str, "\"'"); + + $return = "CONCAT("; + $len = strlen($str); + + for ($i = 0; $i < $len; ++$i) { + $return .= "CHAR(".ord($str[$i])."),"; + } + + if ($i > 0) { + $return = substr($return, 0, -1); + } else { + $return = "\"\""; + } + $return .= ")"; + + return $return; + } + public function renderLoop($type, array $args = array()) { $loopsDefinition = $this->container->getParameter("thelia.parser.loops");