mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02: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
1 changed files with 7 additions and 3 deletions
|
@ -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)) {
|
||||||
|
if (ini_get_bool('magic_quotes_sybase')) { //only unescape single quotes
|
||||||
|
$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);
|
$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…
Add table
Add a link
Reference in a new issue