X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=debugger%2Fcommon.php;h=d6e43fe017eb236d26fe631513ca0f3300bd208b;hb=99b19d0524388c9de2981e77472e4af4124f82af;hp=83153bb6574114daec0d754dab7941f80d15f3e7;hpb=b825566f55fd1aa4dab6b09145848e7d6e957fe5;p=plcapi.git diff --git a/debugger/common.php b/debugger/common.php index 83153bb..d6e43fe 100644 --- a/debugger/common.php +++ b/debugger/common.php @@ -1,15 +1,55 @@ $v) { + if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) { + unset($GLOBALS[$k]); + } + } + } + unregister_globals(); +} + // work around magic quotes -if (get_magic_quotes_gpc()) { +if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { function stripslashes_deep($value) { $value = is_array($value) ? @@ -22,15 +62,21 @@ if (get_magic_quotes_gpc()) { $_GET = array_map('stripslashes_deep', $_GET); } +$preferredEncodings = 'UTF-8, ASCII, ISO-8859-1, UTF-7, EUC-JP, SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP'; +$inputcharset = mb_detect_encoding(urldecode($_SERVER['REQUEST_URI']), $preferredEncodings); if (isset($_GET['usepost']) && $_GET['usepost'] === 'true') { $_GET = $_POST; + $inputcharset = mb_detect_encoding(implode('', $_GET), $preferredEncodings); } +/// @todo if $inputcharset is not UTF8, we should probably re-encode $_GET to make it UTF-8 + // recover input parameters +/// @todo instead of using globals, move them to an array. Also: use a class for this parsing... $debug = false; $protocol = 0; $run = false; -$wstype = 0; +$wstype = defined('DEFAULT_WSTYPE') ? DEFAULT_WSTYPE : 0; $id = ''; if (isset($_GET['action'])) { if (isset($_GET['wstype']) && $_GET['wstype'] == '1') {