mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
modify stripslashes_safe() to work properly under magic_quotes_sybase
(both addslashes and stripslashes do it properly based on the setting)
This commit is contained in:
parent
f2b5d7e3b7
commit
de64b6c69e
@ -358,9 +358,13 @@ function stripslashes_safe($mixed) {
|
|||||||
if (empty($mixed)) {
|
if (empty($mixed)) {
|
||||||
//nothing to do...
|
//nothing to do...
|
||||||
} else if (is_string($mixed)) {
|
} else if (is_string($mixed)) {
|
||||||
$mixed = str_replace("\\'", "'", $mixed);
|
if (ini_get_bool('magic_quotes_sybase')) { //only unescape single quotes
|
||||||
$mixed = str_replace('\\"', '"', $mixed);
|
$mixed = str_replace("''", "'", $mixed);
|
||||||
$mixed = str_replace('\\\\', '\\', $mixed);
|
} else { //the rest, simple and double quotes and backslashes
|
||||||
|
$mixed = str_replace("\\'", "'", $mixed);
|
||||||
|
$mixed = str_replace('\\"', '"', $mixed);
|
||||||
|
$mixed = str_replace('\\\\', '\\', $mixed);
|
||||||
|
}
|
||||||
} else if (is_array($mixed)) {
|
} else if (is_array($mixed)) {
|
||||||
foreach ($mixed as $key => $value) {
|
foreach ($mixed as $key => $value) {
|
||||||
$mixed[$key] = stripslashes_safe($value);
|
$mixed[$key] = stripslashes_safe($value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user