From 3b72a6a4f42029d5d854724beca65e4e1969ce0a Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 29 Jul 2013 12:22:58 +0000 Subject: [PATCH] 2013-07-29 Miguel de Dios * extensions/api_checker.php: a tiny extension to make more easy the checks in the api, it is a early version but works. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8590 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 + pandora_console/extensions/api_checker.php | 219 +++++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100755 pandora_console/extensions/api_checker.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index cc898486a6..6bdd2ebf8b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2013-07-29 Miguel de Dios + + * extensions/api_checker.php: a tiny extension to make more easy + the checks in the api, it is a early version but works. + 2013-07-29 Sergio Martin * godmode/reporting/reporting_builder.main.php diff --git a/pandora_console/extensions/api_checker.php b/pandora_console/extensions/api_checker.php new file mode 100755 index 0000000000..8a1a160799 --- /dev/null +++ b/pandora_console/extensions/api_checker.php @@ -0,0 +1,219 @@ + $url, 'result' => $result); + + return $return; +} + +function extension_api_checker() { + global $config; + + $url = io_safe_output(get_parameter('url', '')); + + $ip = io_safe_output(get_parameter('ip', '127.0.0.1')); + $pandora_url = io_safe_output(get_parameter('pandora_url', $config['homeurl_static'])); + $apipass = io_safe_output(get_parameter('apipass', '')); + $user = io_safe_output(get_parameter('user', $config['id_user'])); + $password = io_safe_output(get_parameter('password', '')); + + $op = io_safe_output(get_parameter('op', 'get')); + $op2 = io_safe_output(get_parameter('op2', 'test')); + $id = io_safe_output(get_parameter('id', '')); + $id2 = io_safe_output(get_parameter('id2', '')); + $return_type = io_safe_output(get_parameter('return_type', '')); + $other = io_safe_output(get_parameter('other', '')); + $other_mode = io_safe_output(get_parameter('other', 'url_encode_separator_|')); + + $api_execute = get_parameter('api_execute', 0); + + $return_call_api = ''; + if ($api_execute) { + $return_call_api = + api_execute($url, $ip, $pandora_url, $apipass, $user, $password, + $op, $op2, $id, $id2, $return_type, $other, $other_mode); + } + + ui_print_page_header (__("API checker"), + "images/extensions.png", false, "", true, ""); + + $table = null; + $table->data = array(); + + $row = array(); + $row[] = __("IP"); + $row[] = html_print_input_text('ip', $ip, '', 50, 255, true); + $table->data[] = $row; + + $row = array(); + $row[] = __("Pandora Console URL"); + $row[] = html_print_input_text('pandora_url', $pandora_url, '', 50, 255, true); + $table->data[] = $row; + + $row = array(); + $row[] = __("API Pass"); + $row[] = html_print_input_password('apipass', $apipass, '', 50, 255, true); + $table->data[] = $row; + + $row = array(); + $row[] = __("User"); + $row[] = html_print_input_text('user', $user, '', 50, 255, true); + $table->data[] = $row; + + $row = array(); + $row[] = __("Password"); + $row[] = html_print_input_password('password', $password, '', 50, 255, true); + $table->data[] = $row; + + $table2 = null; + $table2->data = array(); + + $row = array(); + $row[] = __("Action (get or set)"); + $row[] = html_print_input_text('op', $op, '', 50, 255, true); + $table2->data[] = $row; + + $row = array(); + $row[] = __("Operation"); + $row[] = html_print_input_text('op2', $op2, '', 50, 255, true); + $table2->data[] = $row; + + $row = array(); + $row[] = __("ID"); + $row[] = html_print_input_text('id', $id, '', 50, 255, true); + $table2->data[] = $row; + + $row = array(); + $row[] = __("ID 2"); + $row[] = html_print_input_text('id', $id2, '', 50, 255, true); + $table2->data[] = $row; + + $row = array(); + $row[] = __("Return Type"); + $row[] = html_print_input_text('return_type', $return_type, '', 50, 255, true); + $table2->data[] = $row; + + $row = array(); + $row[] = __("Other"); + $row[] = html_print_input_text('other', $other, '', 50, 255, true); + $table2->data[] = $row; + + $row = array(); + $row[] = __("Other Mode"); + $row[] = html_print_input_text('other_mode', $other_mode, '', 50, 255, true); + $table2->data[] = $row; + + $table3 = null; + $table3->data = array(); + + $row = array(); + $row[] = __("Raw URL"); + $row[] = html_print_input_text('url', $url, '', 150, 255, true); + $table3->data[] = $row; + + echo "
"; + echo "
"; + echo "" . __('Credentials') . ""; + html_print_table($table); + echo "
"; + + echo "
"; + echo "" . __('Call parameters') . ""; + html_print_table($table2); + echo "
"; + echo "
"; + html_print_input_hidden('api_execute', 1); + html_print_submit_button(__('Call'), 'submit', false, 'class="sub"'); + echo "
"; + echo "
"; + + + echo "
"; + echo "
"; + echo "" . __('Custom URL') . ""; + html_print_table($table3); + echo "
"; + + echo "
"; + html_print_input_hidden('api_execute', 1); + html_print_submit_button(__('Call'), 'submit', false, 'class="sub"'); + echo "
"; + echo "
"; + + if ($api_execute) { + echo "
"; + echo "" . __('Result') . ""; + echo __('URL') . "
"; + html_print_input_password('url', $return_call_api['url'], '', 150, 255, false, true); + echo " "; + html_print_image("images/input_zoom.png"); + echo ""; + echo "
"; + echo __('Result') . "
"; + html_print_textarea('result', 30, 20, $return_call_api['result'], 'readonly="readonly"'); + echo "
"; + } + ?> + + \ No newline at end of file