2012-12-03 Ramon Novoa <rnovoa@artica.es>

* include/functions_agents.php,
	  include/functions_treeview.php: Improved error detection and small fixes.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7216 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2012-12-03 10:05:20 +00:00
parent bc61c0c412
commit 3117e6f205
3 changed files with 32 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2012-12-03 Ramon Novoa <rnovoa@artica.es>
* include/functions_agents.php,
include/functions_treeview.php: Improved error detection and small fixes.
2012-12-03 Hirofumi Kosaka <kosaka@rworks.jp>
* include/functions_html.php: Use "autocomplete=off" in all

View File

@ -401,6 +401,8 @@ function agents_get_agents ($filter = false, $fields = false, $access = 'AR', $o
elseif (! is_array ($filter['id_grupo'])) {
$all_groups = false;
//If group is specified but not allowed, return false
echo "GROUP: " . $filter['id_grupo'] . ":";
print_r ($groups);
if (! in_array ($filter['id_grupo'], $groups)) {
return false;
}

View File

@ -261,8 +261,12 @@ function treeview_printTree($type) {
echo "<li style='margin: 0px 0px 0px 0px;'>";
// Convert the id to hexadecimal, since it will be used as a div id
$hex_id = unpack ('H*', $item['_id_']);
$hex_id = $hex_id[1];
if (defined ('METACONSOLE')) {
$id = unpack ('H*', $item['_id_']);
$id = $hex_id[1];
} else {
$id = $item['_id_'];
}
echo "<a onfocus='JavaScript: this.blur()' href='javascript: loadSubTree(\"" . $type . "\",\"" . $hex_id . "\", " . $lessBranchs . ", \"\", \"\")'>";
echo $img . $item['_iconImg_'] ."&nbsp;" . __($item['_name_']) . ' ('.
@ -769,14 +773,6 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
//Extract all rows of data for each type
switch ($type) {
case 'group':
if (defined ('METACONSOLE')) {
$id = groups_get_id (pack ('H*', $id));
if ($id == '') {
return false;
}
}
$sql = agents_get_agents(array (
'order' => 'nombre COLLATE utf8_general_ci ASC',
'id_grupo' => $id,
@ -787,6 +783,14 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
'AR',
false,
true);
if (defined ('METACONSOLE')) {
$id = groups_get_id (pack ('H*', $id));
if ($id == '') {
return false;
}
}
break;
case 'os':
@ -884,19 +888,24 @@ function treeview_getFirstBranchSQL ($type, $id, $avariableGroupsIds, $statusSel
', $name);
break;
case 'tag':
$id = tags_get_id (pack ('H*', $id));
if ($id === false) {
return false;
}
$sql = "SELECT tagente.*
FROM tagente, tagente_modulo, ttag_module
WHERE tagente.id_agente = tagente_modulo.id_agente
AND tagente_modulo.id_agente_modulo = ttag_module.id_agente_modulo
AND ttag_module.id_tag = " . $id;
$id = tags_get_id (pack ('H*', $id));
if ($id === false) {
return false;
}
break;
}
if ($sql === false || $sql == '') {
return false;
}
$sql .= ' AND tagente.disabled = 0'. $search_sql;
return $sql;
}