From f65b4439d4fe420032a65ec83d8f07d61662370f Mon Sep 17 00:00:00 2001 From: mdtrooper <tres.14159@gmail.com> Date: Thu, 27 May 2010 15:23:46 +0000 Subject: [PATCH] 2010-05-27 Miguel de Dios <miguel.dedios@artica.es> * include/functions_api.php, include/api.php: cleaned and organice the source code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2811 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/api.php | 11 ++++++----- pandora_console/include/functions_api.php | 8 +++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c13fcbfc1c..99a98a5896 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2010-05-27 Miguel de Dios <miguel.dedios@artica.es> + + * include/functions_api.php, include/api.php: cleaned and organice the + source code. + 2010-05-27 Ramon Novoa <rnovoa@artica.es> * extensions/update_manager/main.php: Show an error instead of diff --git a/pandora_console/include/api.php b/pandora_console/include/api.php index b7220408e6..7a9d2df491 100644 --- a/pandora_console/include/api.php +++ b/pandora_console/include/api.php @@ -1,5 +1,4 @@ <?php - //Pandora FMS- http://pandorafms.com // ================================================== // Copyright (c) 2005-2009 Artica Soluciones Tecnologicas @@ -14,21 +13,23 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -//Set character encoding to UTF-8 - fixes a lot of multibyte character headaches - require_once ("config.php"); require_once("functions_api.php"); enterprise_include_once ('include/functions_enterprise_api.php'); -//Get the parameters and parse if necesary. $ipOrigin = $_SERVER['REMOTE_ADDR']; + +//Get the parameters and parse if necesary. $op = get_parameter('op'); $op2 = get_parameter('op2'); $id = get_parameter('id'); $id2 = get_parameter('id2'); -$other = parseOtherParameter(get_parameter('other'), get_parameter('other_mode', 'url_encode')); +$otherSerialize = get_parameter('other'); +$otherMode = get_parameter('other_mode', 'url_encode'); $returnType = get_parameter('return_type', 'string'); +$other = parseOtherParameter($otherSerialize, $otherMode); + if (isInACL($ipOrigin)) { if (($op !== 'get') && ($op !== 'set') && ($op !== 'help')) returnError('no_set_no_get_no_help', $returnType); diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 21b88f0e11..2a3ca8e835 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -35,7 +35,7 @@ function parseOtherParameter($other, $otherType) { default: if (strpos($otherType, 'url_encode_separator_') !== false) { $separator = str_replace('url_encode_separator_', '', $otherType); - $returnVar = array('type' => 'array', 'data' => explode($separator,$other)); + $returnVar = array('type' => 'array', 'data' => explode($separator, $other)); foreach ($returnVar['data'] as $index => $element) $returnVar['data'][$index] = urldecode($element); } @@ -79,7 +79,9 @@ function returnError($typeError, $returnType) { * * @param $returnType * @param $data - * @return unknown_type + * @param $separator + * + * @return */ function returnData($returnType, $data, $separator = ';') { switch ($returnType) { @@ -117,7 +119,7 @@ function returnData($returnType, $data, $separator = ';') { } else { foreach($data['data'] as $dataContent) { - echo implode($separator, $dataContent) . "\n"; + echo implode($separator, $dataContent) . "\n"; } } break;