2011-03-02 Miguel de Dios <miguel.dedios@artica.es>

* 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@4048 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2011-03-02 14:34:38 +00:00
parent 6fe5712f9c
commit a4cec87368
2 changed files with 23 additions and 5 deletions

View File

@ -952,4 +952,17 @@ function postgresql_process_sql_commit() {
function postgresql_process_sql_rollback() {
pg_query('ROLLBACK TRANSACTION');
}
/**
* Put quotes if magic_quotes protection
*
* @param string Text string to be protected with quotes if magic_quotes protection is disabled
*/
function postgresql_safe_sql_string($string) {
if (get_magic_quotes_gpc () == 0)
return $string;
global $config;
return pg_escape_string($config['dbconnection'], $string);
}
?>

View File

@ -1005,12 +1005,17 @@ if (!function_exists ("mb_strtoupper")) {
*
* @param string Text string to be protected with quotes if magic_quotes protection is disabled
*/
function safe_sql_string ($string) {
if (get_magic_quotes_gpc () == 0)
return $string;
function safe_sql_string($string) {
global $config;
return mysql_real_escape_string ($string, $config['dbconnection']);
switch ($config["dbtype"]) {
case "mysql":
return mysql_safe_sql_string($string);
break;
case "postgresql":
return postgresql_safe_sql_string($string);
break;
}
}
/**