From 2a9a2885e6eaefb2c2ef69c97fc7316ff7feebeb Mon Sep 17 00:00:00 2001 From: Stefan Darius Date: Wed, 15 Jul 2026 16:29:50 +0300 Subject: [PATCH] refactor custom_mi_command handling for consistent command display --- web/common/tools/tviewer/apply_changes.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/web/common/tools/tviewer/apply_changes.php b/web/common/tools/tviewer/apply_changes.php index 45d7d889..b1421954 100755 --- a/web/common/tools/tviewer/apply_changes.php +++ b/web/common/tools/tviewer/apply_changes.php @@ -37,7 +37,7 @@ if (file_exists("../../../../config/tools/".get_tool_path($module_id)."/tviewer.inc.php")) require_once("../../../../config/tools/".get_tool_path($module_id)."/tviewer.inc.php"); -$command=$custom_config[$module_id][$_SESSION[$module_id]['submenu_item_id']]['custom_mi_command']; +$custom_mi_command=$custom_config[$module_id][$_SESSION[$module_id]['submenu_item_id']]['custom_mi_command']; /* * custom_mi_command may be given either as: @@ -46,18 +46,24 @@ * - an array: array("command", array("param1"=>"value1", ...)) to pass * named params (the second element may be omitted for no params). */ -if (is_array($command)) { - $params = isset($command[1]) ? $command[1] : NULL; - $command = $command[0]; -} elseif (strpos($command, " ")) { - $params = explode(" ", $command); +if (is_array($custom_mi_command)) { + $params = isset($custom_mi_command[1]) ? $custom_mi_command[1] : NULL; + $command = $custom_mi_command[0]; +} elseif (strpos($custom_mi_command, " ")) { + $params = explode(" ", $custom_mi_command); $command = array_shift($params); } else { $params = NULL; + $command = $custom_mi_command; +} + +$display_command = $command; +if (!empty($params)) { + $display_command .= " " . json_encode($params); } ?> -
Sending MI command: +
Sending MI command: