diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php
index 071c14da4e..0249ec1b9c 100755
--- a/pandora_console/include/functions_treeview.php
+++ b/pandora_console/include/functions_treeview.php
@@ -889,7 +889,7 @@ function treeview_getData ($type) {
array_push($list, array('id' => 0, 'name' => 'No policy'));
}
else {
- $list = db_get_all_rows_sql("SELECT DISTINCT tpolicies.id,
+ $sql = "SELECT DISTINCT tpolicies.id,
tpolicies.name
FROM tpolicies, tpolicy_modules, tagente_estado,
tagente, tagente_modulo
@@ -904,7 +904,12 @@ function treeview_getData ($type) {
tagente.id_grupo IN ($groups) AND
tagente.disabled = 0 AND
tagente_modulo.disabled = 0
- ORDER BY tpolicies.name ' . $order_collate . ' ASC");
+ ORDER BY tpolicies.name " . $order_collate . " ASC";
+
+ $list = db_get_all_rows_sql($sql);
+ if ($list === false)
+ $list = array();
+
$element = 0;
switch ($select_status) {
diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php
index 922f1c45b1..29dd9e4b0d 100644
--- a/pandora_console/operation/tree.php
+++ b/pandora_console/operation/tree.php
@@ -26,14 +26,15 @@ require_once ($config['homedir'] . '/include/functions_treeview.php');
if (defined ('METACONSOLE')) {
// For each server defined:
- $servers = db_get_all_rows_sql ("SELECT * FROM tmetaconsole_setup WHERE disabled = 0");
+ $servers = db_get_all_rows_sql ("SELECT *
+ FROM tmetaconsole_setup
+ WHERE disabled = 0");
if ($servers === false) {
$servers = array();
}
}
-if (is_ajax ())
-{
+if (is_ajax ()) {
require_once ($config['homedir'] . '/include/functions_reporting.php');
require_once ($config['homedir'] . '/include/functions_users.php');
require_once ($config['homedir'] . '/include/functions_servers.php');
@@ -453,7 +454,7 @@ if (is_ajax ())
echo " ";
}
- echo "";
+ echo "";
echo ui_print_truncate_text(io_safe_output($row['nombre']), 40, true);
echo "";
if ($row['quiet']) {