From: gggeek Date: Wed, 30 Dec 2020 18:56:59 +0000 (+0000) Subject: minor improvements in the debugger to allow easier integration of phpxmlrpc/jsonrpc... X-Git-Tag: plcapi-7.1-0~3^2~90 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=dba72babd70d30191faa571d8582dfe5e876f5eb;p=plcapi.git minor improvements in the debugger to allow easier integration of phpxmlrpc/jsonrpc and friends --- diff --git a/debugger/action.php b/debugger/action.php index 076b1c0..7a2b61d 100644 --- a/debugger/action.php +++ b/debugger/action.php @@ -92,10 +92,8 @@ header('Content-Type: text/html; charset=utf-8'); $v) { + if (!in_array($k, $noUnset) && isset($GLOBALS[$k])) { + unset($GLOBALS[$k]); + } + } + } + unregister_globals(); +} + // work around magic quotes if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { function stripslashes_deep($value) @@ -35,10 +72,11 @@ if (isset($_GET['usepost']) && $_GET['usepost'] === 'true') { /// @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') { diff --git a/debugger/controller.php b/debugger/controller.php index 444028d..8656526 100644 --- a/debugger/controller.php +++ b/debugger/controller.php @@ -10,11 +10,11 @@ * @todo add support for more options, such as ntlm auth to proxy, or request charset encoding * @todo parse content of payload textarea to be fed to visual editor * @todo add http no-cache headers - * @todo if jsonrpc php classes are not available, do not display the JSONRPC option + * @todo if jsonrpc php classes are not available, gray out or hide altogether the JSONRPC option & title * @todo if js libs are not available, do not try to load them **/ -// make sure we set the correct charset type for output, so that we can display all characters +// Make sure we set the correct charset type for output, so that we can display all characters header('Content-Type: text/html; charset=utf-8'); include __DIR__ . '/common.php'; @@ -22,9 +22,10 @@ if ($action == '') { $action = 'list'; } -// relative path to the visual xmlrpc editing dialog -$editorpath = '../../phpjsrpc/debugger/'; -$editorlibs = '../../phpjsrpc/lib/'; +// Relative path to the visual xmlrpc editing dialog +// We allow to easily configure this path via defines +$editorpath = (defined('JSXMLRPC_PATH') ? JSXMLRPC_PATH : '../..') . '/jsxmlrpc/debugger/'; +$editorlibs = (defined('JSXMLRPC_PATH') ? JSXMLRPC_PATH : '../..') . '/jsxmlrpc/lib/'; ?> @@ -229,9 +230,9 @@ $editorlibs = '../../phpjsrpc/lib/'; echo ' document.forms[2].submit();'; } ?>">

XMLRPC -
+
/>
/ -
+
/>
JSONRPC Debugger (based on the PHP-XMLRPC library)