From 9076974a59c4b2957882b3b7be00704de35bfe68 Mon Sep 17 00:00:00 2001 From: mosmartin Date: Wed, 13 Apr 2011 15:41:26 +0000 Subject: [PATCH] #19690852 Refactoring: updated addQuotes to check if magic quotes are on only once and not on every function call. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8310 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/db/DBCubrid3.class.php | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/classes/db/DBCubrid3.class.php b/classes/db/DBCubrid3.class.php index 2c9c6c84a..a312c7de9 100644 --- a/classes/db/DBCubrid3.class.php +++ b/classes/db/DBCubrid3.class.php @@ -22,7 +22,8 @@ var $prefix = 'xe'; // / prefix = $db_info->db_table_prefix; if (!substr($this->prefix, -1) != '_') $this->prefix .= '_'; + $this->magic_quotes_enabled = (version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()); } /** @@ -123,21 +125,11 @@ { if (!$this->fd) return $string; - if (version_compare (PHP_VERSION, "5.9.0", "<") && - get_magic_quotes_gpc ()) { + if ($this->magic_quotes_enabled) { $string = stripslashes (str_replace ("\\","\\\\", $string)); } - if (!is_numeric ($string)) { - /* - if ($this->isConnected()) { - $string = cubrid_real_escape_string($string); - } - else { - $string = str_replace("'","\'",$string); - } - */ - + if (!is_numeric($string)) { $string = str_replace("'","''",$string); }