diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php
index a560a73bff..de055054cf 100644
--- a/pandora_console/godmode/agentes/agent_manager.php
+++ b/pandora_console/godmode/agentes/agent_manager.php
@@ -268,7 +268,8 @@ $table->data[6][1] = html_print_select (servers_get_names (),
// Description
$table->data[7][0] = __('Description');
-$table->data[7][1] = html_print_input_text ('comentarios', $comentarios, '', 45, 255, true);
+$table->data[7][1] = html_print_input_text ('comentarios', $comentarios,
+ '', 45, 255, true);
html_print_table ($table);
unset($table);
@@ -376,10 +377,12 @@ if ($config['activate_gis']) {
}
$table->data[6][0] = __('Url address');
-$table->data[6][1] = html_print_input_text ('url_description', $url_description, '', 45, 255, true);
+$table->data[6][1] = html_print_input_text ('url_description',
+ $url_description, '', 45, 255, true);
$table->data[7][0] = __('Quiet');
-$table->data[7][0] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
+$table->data[7][0] .= ui_print_help_tip(
+ __('The agent still runs but the alerts and events will be stop'), true);
$table->data[7][1] = html_print_checkbox('quiet', 1, $quiet, true);
ui_toggle(html_print_table ($table, true), __('Advanced options'));
@@ -401,13 +404,16 @@ foreach ($fields as $field) {
$data[0] = ''.$field['name'].'';
- $custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
+ $custom_value = db_get_value_filter('description',
+ 'tagent_custom_data',
+ array('id_field' => $field['id_field'], 'id_agent' => $id_agente));
if ($custom_value === false) {
$custom_value = '';
}
- $data[1] = html_print_textarea ('customvalue_'.$field['id_field'], 2, 65, $custom_value, 'style="min-height: 30px;"', true);
+ $data[1] = html_print_textarea ('customvalue_'.$field['id_field'],
+ 2, 65, $custom_value, 'style="min-height: 30px;"', true);
array_push ($table->data, $data);
}
@@ -433,12 +439,14 @@ echo "";
if ($id_agente) {
- html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
+ html_print_submit_button (__('Update'), 'updbutton', false,
+ 'class="sub upd"');
html_print_input_hidden ('update_agent', 1);
html_print_input_hidden ('id_agente', $id_agente);
}
else {
- html_print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
+ html_print_submit_button (__('Create'), 'crtbutton', false,
+ 'class="sub wand"');
html_print_input_hidden ('create_agent', 1);
}
echo '';
@@ -446,56 +454,90 @@ echo '';
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
ui_require_jquery_file ('bgiframe');
+ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
?>
diff --git a/pandora_console/godmode/massive/massive_edit_agents.php b/pandora_console/godmode/massive/massive_edit_agents.php
index 847119be7c..f66260edf7 100644
--- a/pandora_console/godmode/massive/massive_edit_agents.php
+++ b/pandora_console/godmode/massive/massive_edit_agents.php
@@ -404,7 +404,8 @@ foreach ($fields as $field) {
$custom_value = '';
}
- $data[1] = html_print_textarea ('customvalue_'.$field['id_field'], 2, 65, $custom_value, 'style="min-height: 30px;"', true);
+ $data[1] = html_print_textarea ('customvalue_' . $field['id_field'],
+ 2, 65, $custom_value, 'style="min-height: 30px;"', true);
array_push ($table->data, $data);
}
@@ -433,10 +434,12 @@ ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('pandora.controls');
ui_require_jquery_file ('ajaxqueue');
ui_require_jquery_file ('bgiframe');
+
+ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
?>
diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php
index 8ea2ec6058..73c4660511 100644
--- a/pandora_console/include/ajax/agent.php
+++ b/pandora_console/include/ajax/agent.php
@@ -275,13 +275,16 @@ elseif ($search_agents && ($config['metaconsole'] == 1) && defined('METACONSOLE'
$filter_description = $filter;
switch ($config['dbtype']) {
case "mysql":
- $filter_description[] = '(nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
+ $filter_description[] =
+ '(nombre COLLATE utf8_general_ci NOT LIKE "%'.$string.'%" AND direccion NOT LIKE "%'.$string.'%" AND comentarios LIKE "%'.$string.'%")';
break;
case "postgresql":
- $filter_description[] = '(nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')';
+ $filter_description[] =
+ '(nombre NOT LIKE \'%'.$string.'%\' AND direccion NOT LIKE \'%'.$string.'%\' AND comentarios LIKE \'%'.$string.'%\')';
break;
case "oracle":
- $filter_description[] = '(UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
+ $filter_description[] =
+ '(UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
break;
}
$agents = agents_get_agents($filter_description,
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index a757f35ac9..c51dcb8d2f 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -917,7 +917,7 @@ function api_set_create_custom_field($t1, $t2, $other, $returnType) {
$display_front = 0;
if ($other['data'][1] != '') {
- $display_front = $other['data'][1];
+ $display_front = $other['data'][1];
}
else {
returnError('error_parameter', 'Custom field display flag required');
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index b664a60340..ad7f055a5e 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -6842,7 +6842,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[1] = ui_print_group_icon ($agent_data['id_grupo'], true, '', '', false);
$data[2] = ui_print_os_icon ($agent_data["id_os"], true, true);
$data[3] = $agent_data['direccion'];
- $data[4] = $agent_data['comentarios'];
+ $agent_data_comentarios = strip_tags(ui_bbcode_to_html($agent_data['comentarios']));
+ $data[4] = $agent_data_comentarios;
if ($agent_data['disabled'] == 0)
$data[5] = __('Enabled');
@@ -6985,7 +6986,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[1] = ui_print_group_icon ($agent_data['id_grupo'], true, '', '', false);
$data[2] = ui_print_os_icon ($agent_data["id_os"], true, true);
$data[3] = $agent_data['direccion'];
- $data[4] = $agent_data['comentarios'];
+ $agent_data_comentarios = strip_tags(ui_bbcode_to_html($agent_data['comentarios']));
+ $data[4] = $agent_data_comentarios;
if ($agent_data['disabled'] == 0)
$data[5] = __('Enabled');
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index c39c4b98a1..a9194f9908 100644
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -29,6 +29,19 @@ if (isset($config['homedir'])) {
require_once($config['homedir'] . '/include/functions_html.php');
}
+function ui_bbcode_to_html($text, $allowed_tags = array('[url]')) {
+ $return = "";
+
+ $return = $text;
+
+ if (array_search('[url]', $allowed_tags) !== false) {
+ $return = str_replace('[/url]', '', $return);
+ $return = preg_replace("/\[url=([^\]]*)\]/", "", $return);
+ }
+
+ return $return;
+}
+
/**
* Truncate a text to num chars (pass as parameter) and if flag show tooltip is
* true the html artifal to show the tooltip with rest of text.
diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php
index ddff185966..6c180c2b35 100644
--- a/pandora_console/mobile/operation/agent.php
+++ b/pandora_console/mobile/operation/agent.php
@@ -143,7 +143,7 @@ class Agent {
$description .= '' . __('N/A') . '';
}
else {
- $description .= $this->agent["comentarios"];
+ $description .= ui_bbcode_to_html($this->agent["comentarios"]);
}
diff --git a/pandora_console/operation/agentes/custom_fields.php b/pandora_console/operation/agentes/custom_fields.php
index 5065b4c3ad..b794e39730 100644
--- a/pandora_console/operation/agentes/custom_fields.php
+++ b/pandora_console/operation/agentes/custom_fields.php
@@ -82,6 +82,9 @@ else {
if ($custom_value === false || $custom_value == '') {
$custom_value = '-'.__('empty').'-';
}
+ else {
+ $custom_value = ui_bbcode_to_html($custom_value);
+ }
$data[2] = $custom_value;
diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php
index 03afbeeb1b..9ec92dfb75 100644
--- a/pandora_console/operation/agentes/estado_generalagente.php
+++ b/pandora_console/operation/agentes/estado_generalagente.php
@@ -113,7 +113,8 @@ $data[0] .= ui_print_help_tip(__('Agent statuses are re-calculated by the server
$data[0] .= '';
$table_agent->rowspan[count($table_agent->data)][0] = 6;
$table_agent->colspan[count($table_agent->data)][0] = 2;
-$table_agent->cellstyle[count($table_agent->data)][0] = 'width: 150px; text-align:center; padding: 0px; vertical-align: top;';
+$table_agent->cellstyle[count($table_agent->data)][0] =
+ 'width: 150px; text-align:center; padding: 0px; vertical-align: top;';
$data[2] = ui_print_os_icon ($agent["id_os"], false, true, true, false, false, false, array('title' => __('OS') . ': ' . get_os_name ($agent["id_os"])));
@@ -159,11 +160,14 @@ $table_agent->data[] = $data;
$table_agent->rowclass[] = '';
$data = array();
-$data[2] = html_print_image('images/default_list.png', true, array('title' => __('Description')));
+$data[2] = html_print_image('images/default_list.png', true,
+ array('title' => __('Description')));
$table_agent->cellstyle[count($table_agent->data)][2] =
'width: 16px; text-align: right; padding: 0px; vertical-align: top;';
$data[3] = '';
-$data[3] .= empty($agent["comentarios"]) ? '' . __('N/A') . '' : $agent["comentarios"];
+$data[3] .= empty($agent["comentarios"]) ?
+ '' . __('N/A') . '' :
+ ui_bbcode_to_html($agent["comentarios"]);
$data[3] .= '';
$table_agent->colspan[count($table_agent->data)][3] = 2;
@@ -576,9 +580,15 @@ if ($config["agentaccess"] && $access_agent > 0) {
}
$data[1] = html_print_table($table_contact, true);
-$data[1] .= empty($table_data->data) ? '' : '
' . html_print_table($table_data, true);
-$data[1] .= !isset($table_incident) ? '' : '
' . html_print_table($table_incident, true);
-$data[1] .= !isset($table_interface) ? '' : '
' . html_print_table($table_interface, true);
+$data[1] .= empty($table_data->data) ?
+ '' :
+ '
' . html_print_table($table_data, true);
+$data[1] .= !isset($table_incident) ?
+ '' :
+ '
' . html_print_table($table_incident, true);
+$data[1] .= !isset($table_interface) ?
+ '' :
+ '
' . html_print_table($table_interface, true);
$table->rowspan[0][1] = 2;
diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php
index e92470e810..dbd9234eab 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -897,9 +897,12 @@ foreach ($config['extensions'] as $extension) {
if ($extension['extension_ope_tab']['id'] === "vmware_manager") {
//Check if OS is vmware
- $id_remote_field = db_get_value ("id_field", "tagent_custom_fields", "name", "vmware_type");
+ $id_remote_field = db_get_value ("id_field",
+ "tagent_custom_fields", "name", "vmware_type");
- $vmware_type = db_get_value_filter("description", "tagent_custom_data", array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
+ $vmware_type = db_get_value_filter("description",
+ "tagent_custom_data",
+ array("id_field" => $id_remote_field, "id_agent" => $agent["id_agente"]));
if ($vmware_type != "vm") {
continue;