Merge branch 'MDL-13331_m19' of git://github.com/nebgor/moodle into MOODLE_19_STABLE

This commit is contained in:
Sam Hemelryk
2011-08-29 11:24:26 +12:00
+7 -2
View File
@@ -151,11 +151,16 @@ function search_shorten_url($url, $length=30) {
* @return the escaped string
*/
function search_escape_string($str) {
global $CFG;
global $CFG, $db;
switch ($CFG->dbfamily) {
case 'mysql':
$s = mysql_real_escape_string($str);
if ($CFG->dbtype == 'mysqli') {
//ugly hack for 1.9 stable ONLY to get it to work for mysqli.
$s = mysqli_real_escape_string($db->_connectionID, $str);
} else {
$s = mysql_real_escape_string($str);
}
break;
case 'postgres':
$s = pg_escape_string($str);