From 091d81f51bdefb77bbc7afa51eafeedaddbe115e Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Wed, 2 Mar 2011 14:33:24 +0000 Subject: [PATCH] 2011-03-02 Miguel de Dios * include/db/postgresql.php, include/db/mysql.php, include/functions.php: separate the function "mysql_safe_sql_string" into the two version for MySQL and PostgreSQL engine. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4047 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++++ pandora_console/include/db/mysql.php | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index eb0d07e0f8..d364d68431 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-03-02 Miguel de Dios + + * include/db/postgresql.php, include/db/mysql.php, include/functions.php: + separate the function "mysql_safe_sql_string" into the two version for MySQL + and PostgreSQL engine. + 2011-03-02 Miguel de Dios * include/db/postgresql.php: fixed in the function diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index 15acb22cfd..3e48c5a752 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -936,4 +936,18 @@ function mysql_process_sql_rollback() { mysql_query ('ROLLBACK '); mysql_query ('SET AUTOCOMMIT = 0'); } + +/** + * Put quotes if magic_quotes protection + * + * @param string Text string to be protected with quotes if magic_quotes protection is disabled + */ +function mysql_safe_sql_string($string) { + if (get_magic_quotes_gpc () == 0) + return $string; + + global $config; + + return mysql_real_escape_string($string, $config['dbconnection']); +} ?> \ No newline at end of file