remove magic quote handling

This commit is contained in:
Andreas Gohr 2017-03-31 09:54:07 +02:00
parent 361134418d
commit 75ce4e03a1
2 changed files with 1 additions and 55 deletions

View File

@ -36,11 +36,7 @@ if (!defined('DOKU_E_LEVEL') && file_exists(DOKU_CONF.'report_e_all')) {
define('DOKU_E_LEVEL', E_ALL);
}
if (!defined('DOKU_E_LEVEL')) {
if(defined('E_DEPRECATED')){ // since php 5.3, since php 5.4 E_STRICT is part of E_ALL
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
}else{
error_reporting(E_ALL ^ E_NOTICE);
}
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
} else {
error_reporting(DOKU_E_LEVEL);
}
@ -163,18 +159,6 @@ if(!headers_sent() && !defined('NOSESSION')) {
}
}
// kill magic quotes
if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) {
if (!empty($_GET)) remove_magic_quotes($_GET);
if (!empty($_POST)) remove_magic_quotes($_POST);
if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
@ini_set('magic_quotes_gpc', 0);
define('MAGIC_QUOTES_STRIPPED',1);
}
if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0);
@ini_set('magic_quotes_sybase',0);
// don't let cookies ever interfere with request vars
$_REQUEST = array_merge($_GET,$_POST);
@ -404,32 +388,6 @@ function init_creationmodes(){
if($auto_dmode != $conf['dmode']) $conf['dperm'] = $conf['dmode'];
}
/**
* remove magic quotes recursivly
*
* @author Andreas Gohr <andi@splitbrain.org>
*
* @param $array
*/
function remove_magic_quotes(&$array) {
foreach (array_keys($array) as $key) {
// handle magic quotes in keynames (breaks order)
$sk = stripslashes($key);
if($sk != $key){
$array[$sk] = $array[$key];
unset($array[$key]);
$key = $sk;
}
// do recursion if needed
if (is_array($array[$key])) {
remove_magic_quotes($array[$key]);
}else {
$array[$key] = stripslashes($array[$key]);
}
}
}
/**
* Returns the full absolute URL to the directory where
* DokuWiki is installed in (includes a trailing slash)

View File

@ -16,18 +16,6 @@ require_once(DOKU_INC.'inc/init.php');
if (!defined('DOKU_E_LEVEL')) { error_reporting(E_ALL ^ E_NOTICE); }
else { error_reporting(DOKU_E_LEVEL); }
// kill magic quotes
if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) {
if (!empty($_GET)) remove_magic_quotes($_GET);
if (!empty($_POST)) remove_magic_quotes($_POST);
if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
@ini_set('magic_quotes_gpc', 0);
define('MAGIC_QUOTES_STRIPPED',1);
}
if (function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0);
@ini_set('magic_quotes_sybase',0);
// language strings
require_once(DOKU_INC.'inc/lang/en/lang.php');
if(isset($_REQUEST['l']) && !is_array($_REQUEST['l'])) {