2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Fixes lp:1255359 Translation strings with single quotes break some SQL queries

This commit is contained in:
Adam Zammit
2013-11-27 12:03:07 +11:00
parent dc5a7e8ba9
commit e5feb27daa
25 changed files with 80 additions and 67 deletions

View File

@@ -48,6 +48,19 @@ function translate_array(&$a,$b)
if (isset($row[$el])) $row[$el] = T_($row[$el]);
}
/**
* Translate then quote a string to make it ready
* for database insertion
*
* @param string $msg The message to translate and quote
* @return string The translated message quoted
*/
function TQ_($msg)
{
$msg = T_($msg);
$msg = str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$msg);
return str_replace("'","\\'",$msg);
}
$locale = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);