mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2012-04-25 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php, include/api.php: fixed when some error in get_events__user, and added constants flags for debug in the header of source file. MERGED FROM 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6170 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
bba2910084
commit
6175675263
@ -1,5 +1,13 @@
|
|||||||
2012-04-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
2012-04-25 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_api.php, include/api.php: fixed when some error
|
||||||
|
in get_events__user, and added constants flags for debug in the
|
||||||
|
header of source file.
|
||||||
|
|
||||||
|
MERGED FROM 4.0.2
|
||||||
|
|
||||||
|
2012-04-25 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
* operation/menu.php
|
* operation/menu.php
|
||||||
operation/events/events.php: SoundEvent popup now it's resizable in
|
operation/events/events.php: SoundEvent popup now it's resizable in
|
||||||
IE.
|
IE.
|
||||||
@ -7,7 +15,7 @@
|
|||||||
Merged from branches.
|
Merged from branches.
|
||||||
|
|
||||||
2012-04-25 Vanessa Gil <vanessa.gil@artica.es>
|
2012-04-25 Vanessa Gil <vanessa.gil@artica.es>
|
||||||
|
|
||||||
* godmode/setup/performance.php: Changed the order of options.
|
* godmode/setup/performance.php: Changed the order of options.
|
||||||
|
|
||||||
2012-04-25 Dario Rodriguez <dario.rodriguez@artica.es>
|
2012-04-25 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||||
|
@ -18,6 +18,10 @@ require_once("functions_api.php");
|
|||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
define("DEBUG", 0);
|
||||||
|
define("VERBOSE", 0);
|
||||||
|
|
||||||
|
|
||||||
enterprise_include_once ('include/functions_enterprise_api.php');
|
enterprise_include_once ('include/functions_enterprise_api.php');
|
||||||
|
|
||||||
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
$ipOrigin = $_SERVER['REMOTE_ADDR'];
|
||||||
@ -69,6 +73,14 @@ if ($correctLogin) {
|
|||||||
if (!function_exists($op.'_'.$op2))
|
if (!function_exists($op.'_'.$op2))
|
||||||
returnError('no_exist_operation', $returnType);
|
returnError('no_exist_operation', $returnType);
|
||||||
else {
|
else {
|
||||||
|
if (!DEBUG) {
|
||||||
|
error_reporting(0);
|
||||||
|
}
|
||||||
|
if (VERBOSE) {
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set("display_errors", 1);
|
||||||
|
}
|
||||||
|
|
||||||
call_user_func($op.'_'.$op2, $id, $id2, $other, $returnType, $user_in_db);
|
call_user_func($op.'_'.$op2, $id, $id2, $other, $returnType, $user_in_db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ enterprise_include_once ('include/functions_local_components.php');
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function parseOtherParameter($other, $otherType) {
|
function parseOtherParameter($other, $otherType) {
|
||||||
|
|
||||||
switch ($otherType) {
|
switch ($otherType) {
|
||||||
case 'url_encode':
|
case 'url_encode':
|
||||||
$returnVar = array('type' => 'string', 'data' => urldecode($other));
|
$returnVar = array('type' => 'string', 'data' => urldecode($other));
|
||||||
@ -61,7 +61,7 @@ function parseOtherParameter($other, $otherType) {
|
|||||||
* @param $returnType
|
* @param $returnType
|
||||||
* @return unknown_type
|
* @return unknown_type
|
||||||
*/
|
*/
|
||||||
function returnError($typeError, $returnType) {
|
function returnError($typeError, $returnType = 'string') {
|
||||||
switch ($typeError) {
|
switch ($typeError) {
|
||||||
case 'no_set_no_get_no_help':
|
case 'no_set_no_get_no_help':
|
||||||
returnData($returnType,
|
returnData($returnType,
|
||||||
@ -76,8 +76,8 @@ function returnError($typeError, $returnType) {
|
|||||||
array('type' => 'string', 'data' => __('Id does not exist in BD.')));
|
array('type' => 'string', 'data' => __('Id does not exist in BD.')));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
returnData('string',
|
returnData($returnType,
|
||||||
array('type' => 'string', 'data' => __($returnType)));
|
array('type' => 'string', 'data' => __($typeError)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,6 +133,9 @@ function returnData($returnType, $data, $separator = ';') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'string':
|
||||||
|
echo $data['data'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -240,7 +243,7 @@ function get_agent_module_name_last_value($agentName, $moduleName, $other = ';',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
get_module_last_value($idModuleAgent, null, $other, $returnType);
|
get_module_last_value($idModuleAgent, null, $other, $returnType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,13 +534,13 @@ function get_tree_agents($trash1, $trahs2, $other, $returnType)
|
|||||||
else
|
else
|
||||||
$data['list_index'] = array(
|
$data['list_index'] = array(
|
||||||
'type_row',
|
'type_row',
|
||||||
|
|
||||||
'group_id',
|
'group_id',
|
||||||
'group_name',
|
'group_name',
|
||||||
'group_parent',
|
'group_parent',
|
||||||
'disabled',
|
'disabled',
|
||||||
'custom_id',
|
'custom_id',
|
||||||
|
|
||||||
'agent_id',
|
'agent_id',
|
||||||
'agent_name',
|
'agent_name',
|
||||||
'agent_direction',
|
'agent_direction',
|
||||||
@ -603,7 +606,7 @@ function get_tree_agents($trash1, $trahs2, $other, $returnType)
|
|||||||
'module_last_execution_try',
|
'module_last_execution_try',
|
||||||
'module_status_changes',
|
'module_status_changes',
|
||||||
'module_last_status',
|
'module_last_status',
|
||||||
|
|
||||||
'alert_id_agent_module',
|
'alert_id_agent_module',
|
||||||
'alert_id_alert_template',
|
'alert_id_alert_template',
|
||||||
'alert_internal_counter',
|
'alert_internal_counter',
|
||||||
@ -680,7 +683,7 @@ function get_tree_agents($trash1, $trahs2, $other, $returnType)
|
|||||||
*/
|
*/
|
||||||
function set_new_agent($thrash1, $thrash2, $other, $thrash3) {
|
function set_new_agent($thrash1, $thrash2, $other, $thrash3) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$name = $other['data'][0];
|
$name = $other['data'][0];
|
||||||
$ip = $other['data'][1];
|
$ip = $other['data'][1];
|
||||||
$idParent = $other['data'][2];
|
$idParent = $other['data'][2];
|
||||||
@ -4465,6 +4468,8 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
|
|||||||
$groups = users_get_groups ($user_in_db, "IR");
|
$groups = users_get_groups ($user_in_db, "IR");
|
||||||
$is_admin = (bool)db_get_value('is_admin', 'tusuario', 'id_user', $user_in_db);
|
$is_admin = (bool)db_get_value('is_admin', 'tusuario', 'id_user', $user_in_db);
|
||||||
|
|
||||||
|
$sql_post = '';
|
||||||
|
|
||||||
if (!empty($groups)) {
|
if (!empty($groups)) {
|
||||||
$sql_post = " AND id_grupo IN (".implode (",", array_keys ($groups)).")";
|
$sql_post = " AND id_grupo IN (".implode (",", array_keys ($groups)).")";
|
||||||
}
|
}
|
||||||
@ -4702,6 +4707,11 @@ function get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_d
|
|||||||
function get_events($trash1, $trash2, $other, $returnType, $user_in_db = null) {
|
function get_events($trash1, $trash2, $other, $returnType, $user_in_db = null) {
|
||||||
if ($user_in_db !== null) {
|
if ($user_in_db !== null) {
|
||||||
get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_db);
|
get_events__with_user($trash1, $trash2, $other, $returnType, $user_in_db);
|
||||||
|
$last_error = error_get_last();
|
||||||
|
if (!empty($last_error)) {
|
||||||
|
returnError('ERROR_API_PANDORAFMS', $returnType);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4716,11 +4726,17 @@ function get_events($trash1, $trash2, $other, $returnType, $user_in_db = null) {
|
|||||||
}
|
}
|
||||||
else if ($other['type'] == 'array') {
|
else if ($other['type'] == 'array') {
|
||||||
$separator = $other['data'][0];
|
$separator = $other['data'][0];
|
||||||
|
|
||||||
$filterString = otherParameter2Filter($other);
|
$filterString = otherParameter2Filter($other);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dataRows = db_get_all_rows_filter('tevento', $filterString);
|
$dataRows = db_get_all_rows_filter('tevento', $filterString);
|
||||||
|
$last_error = error_get_last();
|
||||||
|
if (!empty($last_error)) {
|
||||||
|
returnError('ERROR_API_PANDORAFMS', $returnType);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$data['type'] = 'array';
|
$data['type'] = 'array';
|
||||||
$data['data'] = $dataRows;
|
$data['data'] = $dataRows;
|
||||||
|
@ -87,7 +87,11 @@ function users_get_all_model_groups () {
|
|||||||
function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null) {
|
function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup = true, $returnAllColumns = false, $id_groups = null) {
|
||||||
if (empty ($id_user)) {
|
if (empty ($id_user)) {
|
||||||
global $config;
|
global $config;
|
||||||
$id_user = $config['id_user'];
|
|
||||||
|
$id_user = null;
|
||||||
|
if (isset($config['id_user'])) {
|
||||||
|
$id_user = $config['id_user'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($id_groups)) {
|
if (isset($id_groups)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user