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
This commit is contained in:
mdtrooper 2010-05-27 15:23:46 +00:00
parent 416564addf
commit b090faa33b
3 changed files with 16 additions and 8 deletions

View File

@ -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

View File

@ -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);

View File

@ -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) {