diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php index 3b1e2db1ba..13924f56e2 100644 --- a/pandora_console/extensions/quick_shell.php +++ b/pandora_console/extensions/quick_shell.php @@ -298,70 +298,86 @@ function quickShellSettings() ui_require_css_file('wizard'); ui_require_css_file('discovery'); - // Parser. // Gotty settings. Internal communication (WS). - $gotty = get_parameter( - 'gotty', - $config['gotty'] - ); - $gotty_host = get_parameter( - 'gotty_host', - $config['gotty_host'] - ); - $gotty_ssh_port = get_parameter( - 'gotty_ssh_port', - $config['gotty_ssh_port'] - ); - $gotty_telnet_port = get_parameter( - 'gotty_telnet_port', - $config['gotty_telnet_port'] - ); - - $gotty_user = get_parameter( - 'gotty_user', - $config['gotty_user'] - ); - - $gotty_pass = get_parameter( - 'gotty_pass', - io_output_password($config['gotty_pass']) - ); - - $gotty_pass = io_input_password($gotty_pass); - - $changes = 0; - $critical = 0; - if ($config['gotty'] != $gotty) { - config_update_value('gotty', $gotty); - $changes++; - $critical++; + if (isset($config['gotty_host']) === false) { + config_update_value('gotty_host', '127.0.0.1'); } - if ($config['gotty_host'] != $gotty_host) { - config_update_value('gotty_host', $gotty_host); - $changes++; + if (isset($config['gotty_telnet_port']) === false) { + config_update_value('gotty_telnet_port', 8082); } - if ($config['gotty_telnet_port'] != $gotty_telnet_port) { - config_update_value('gotty_telnet_port', $gotty_telnet_port); - $changes++; + if (isset($config['gotty_ssh_port']) === false) { + config_update_value('gotty_ssh_port', 8081); } - if ($config['gotty_ssh_port'] != $gotty_ssh_port) { - config_update_value('gotty_ssh_port', $gotty_ssh_port); - $changes++; - } + // Parser. + if (get_parameter('qs_update', false) !== false) { + // Gotty settings. Internal communication (WS). + $gotty = get_parameter( + 'gotty', + '' + ); + $gotty_host = get_parameter( + 'gotty_host', + $config['gotty_host'] + ); + $gotty_ssh_port = get_parameter( + 'gotty_ssh_port', + $config['gotty_ssh_port'] + ); + $gotty_telnet_port = get_parameter( + 'gotty_telnet_port', + $config['gotty_telnet_port'] + ); - if ($config['gotty_user'] != $gotty_user) { - config_update_value('gotty_user', $gotty_user); - $changes++; - $critical++; - } + $gotty_user = get_parameter( + 'gotty_user', + '' + ); - if ($config['gotty_pass'] != $gotty_pass) { - config_update_value('gotty_pass', $gotty_pass); - $changes++; - $critical++; + $gotty_pass = get_parameter( + 'gotty_pass', + '' + ); + + $gotty_pass = io_input_password($gotty_pass); + + $changes = 0; + $critical = 0; + if ($config['gotty'] != $gotty) { + config_update_value('gotty', $gotty); + $changes++; + $critical++; + } + + if ($config['gotty_host'] != $gotty_host) { + config_update_value('gotty_host', $gotty_host); + $changes++; + } + + if ($config['gotty_telnet_port'] != $gotty_telnet_port) { + config_update_value('gotty_telnet_port', $gotty_telnet_port); + $changes++; + } + + if ($config['gotty_ssh_port'] != $gotty_ssh_port) { + config_update_value('gotty_ssh_port', $gotty_ssh_port); + $changes++; + } + + if ($config['gotty_user'] != $gotty_user) { + config_update_value('gotty_user', $gotty_user); + $changes++; + $critical++; + } + + if ($config['gotty_pass'] != $gotty_pass) { + $gotty_pass = io_input_password($gotty_pass); + config_update_value('gotty_pass', $gotty_pass); + $changes++; + $critical++; + } } // Interface. @@ -447,6 +463,13 @@ function quickShellSettings() 'value' => io_output_password($config['gotty_pass']), ], ], + [ + 'arguments' => [ + 'type' => 'hidden', + 'name' => 'qs_update', + 'value' => 1, + ], + ], [ 'arguments' => [ 'type' => 'submit',