Add policies to general search and deleted help functions
This commit is contained in:
parent
c584367c14
commit
4b6c21bb30
|
@ -20,6 +20,7 @@ $searchGraphs = check_acl($config['id_user'], 0, 'RR');
|
|||
$searchMaps = check_acl($config['id_user'], 0, 'RR');
|
||||
$searchReports = check_acl($config['id_user'], 0, 'RR');
|
||||
$searchUsers = check_acl($config['id_user'], 0, 'UM');
|
||||
$searchPolicies = check_acl($config['id_user'], 0, 'UM');
|
||||
$searchHelps = true;
|
||||
|
||||
echo '<br><div style="margin:auto; width:90%; padding: 10px; background: #fff">';
|
||||
|
@ -44,8 +45,12 @@ $table->style[9] = 'font-weight: bold; text-align: center;';
|
|||
$table->style[10] = 'font-weight: bold; text-align: center;';
|
||||
$table->style[11] = 'font-weight: bold; text-align: center;';
|
||||
$table->style[13] = 'font-weight: bold; text-align: center;';
|
||||
$table->style[14] = 'font-weight: bold; text-align: center;';
|
||||
$table->style[15] = 'font-weight: bold; text-align: center;';
|
||||
|
||||
|
||||
|
||||
|
||||
$table->data[0][0] = html_print_image('images/agent.png', true, ['title' => __('Agents found')]);
|
||||
$table->data[0][1] = "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalAgents).'</a>';
|
||||
$table->data[0][2] = html_print_image('images/module.png', true, ['title' => __('Modules found')]);
|
||||
|
@ -64,8 +69,10 @@ $table->data[0][10] = html_print_image('images/reporting.png', true, ['title' =>
|
|||
$table->data[0][11] = "<a href='index.php?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalReports).'</a>';
|
||||
$table->data[0][12] = html_print_image('images/visual_console_green.png', true, ['title' => __('Maps found')]);
|
||||
$table->data[0][13] = "<a href='index.php?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalMaps).'</a>';
|
||||
$table->data[0][14] = html_print_image('images/help.png', true, ['title' => __('Helps found')]);
|
||||
$table->data[0][15] = "<a href='index.php?search_category=helps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalHelps).'</a>';
|
||||
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
|
||||
$table->data[0][14] = html_print_image('images/policies.png', true, ['title' => __('Policies')]);
|
||||
$table->data[0][15] = "<a href='index.php?search_category=policies&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".sprintf(__('%s Found'), $totalPolicies).'</a>';
|
||||
}
|
||||
|
||||
html_print_table($table);
|
||||
|
||||
|
|
|
@ -0,0 +1,199 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
|
||||
require_once $config['homedir'].'/enterprise/include/functions_policies.php';
|
||||
|
||||
|
||||
$searchpolicies = check_acl($config['id'], 0, 'UM');
|
||||
|
||||
$selectpolicieIDUp = '';
|
||||
$selectpolicieIDDown = '';
|
||||
$selectNameUp = '';
|
||||
$selectNameDown = '';
|
||||
$selectDescriptionUp = '';
|
||||
$selectDescriptionDown = '';
|
||||
$selectId_groupUp = '';
|
||||
$selectId_groupDown = '';
|
||||
$selectStatusUp = '';
|
||||
$selectStatusDown = '';
|
||||
|
||||
switch ($sortField) {
|
||||
case 'id':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectpolicieIDUp = $selected;
|
||||
$order = [
|
||||
'field' => 'id',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectpolicieIDDown = $selected;
|
||||
$order = [
|
||||
'field' => 'id',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectNameUp = $selected;
|
||||
$order = [
|
||||
'field' => 'name',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectNameDown = $selected;
|
||||
$order = [
|
||||
'field' => 'name',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'description':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'description',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectDescriptionDown = $selected;
|
||||
$order = [
|
||||
'field' => 'description',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'last_contact':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectId_groupDown = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'id_group':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectId_groupUp = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectId_groupDown = $selected;
|
||||
$order = [
|
||||
'field' => 'last_connect',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'status':
|
||||
switch ($sort) {
|
||||
case 'up':
|
||||
$selectStatusUp = $selected;
|
||||
$order = [
|
||||
'field' => 'is_admin',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$selectStatusDown = $selected;
|
||||
$order = [
|
||||
'field' => 'is_admin',
|
||||
'order' => 'DESC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$selectpolicieIDUp = $selected;
|
||||
$selectpolicieIDDown = '';
|
||||
$selectNameUp = '';
|
||||
$selectNameDown = '';
|
||||
$selectDescriptionUp = '';
|
||||
$selectDescriptionDown = '';
|
||||
$selectId_groupUp = '';
|
||||
$selectId_groupDown = '';
|
||||
$selectStatusUp = '';
|
||||
$selectStatusDown = '';
|
||||
|
||||
$order = [
|
||||
'field' => 'id',
|
||||
'order' => 'ASC',
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
if ($searchpolicies == 0) {
|
||||
$sql = "SELECT id, name, description, id_group, status FROM tpolicies
|
||||
WHERE name LIKE '%".$stringSearchSQL."%' OR
|
||||
description LIKE '%".$stringSearchSQL."%'
|
||||
ORDER BY ".$order['field'].' '.$order['order'];
|
||||
}
|
||||
|
||||
$sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0);
|
||||
|
||||
|
||||
$policies = db_process_sql($sql);
|
||||
|
||||
if ($policies !== false) {
|
||||
if ($only_count) {
|
||||
unset($policies);
|
||||
}
|
||||
|
||||
$sql = "SELECT COUNT(id) AS count FROM tpolicies
|
||||
WHERE name LIKE '%".$stringSearchSQL."%' OR
|
||||
description LIKE '%".$stringSearchSQL."%'";
|
||||
|
||||
|
||||
// q$totalPolicies = db_get_value_sql($sql);
|
||||
$totalPolicies = count($policies);
|
||||
} else {
|
||||
$totalPolicies = 0;
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
global $config;
|
||||
|
||||
// require_once $config['homedir'].'/include/functions_status.php';
|
||||
require_once $config['homedir'].'/enterprise/include/functions_policies.php';
|
||||
require_once $config['homedir'].'/enterprise/include/functions_groups.php';
|
||||
|
||||
$searchpolicies = check_acl($config['id_user'], 0, 'UM');
|
||||
|
||||
if (!$policies || !$searchpolicies) {
|
||||
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
|
||||
} else {
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = '98%';
|
||||
$table->class = 'databox';
|
||||
|
||||
$table->align = [];
|
||||
$table->align[4] = 'center';
|
||||
|
||||
$table->head = [];
|
||||
$table->head[0] = __('ID').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_policie&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectpolicieIDUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=id_policie&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectpolicieIDDown]).'</a>';
|
||||
$table->head[1] = __('Name').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectNameUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=name&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectNameDown]).'</a>';
|
||||
$table->head[2] = __('Description').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=description&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectDescriptionUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=description&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectDescriptionDown]).'</a>';
|
||||
$table->head[3] = __('Id_group').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectId_groupUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=last_contact&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectId_groupDown]).'</a>';
|
||||
$table->head[4] = __('Status').' '.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=status&sort=up">'.html_print_image('images/sort_up.png', true, ['style' => $selectStatusUp]).'</a>'.'<a href="index.php?search_category=policies&keywords='.$config['search_keywords'].'&head_search_keywords=abc&offset='.$offset.'&sort_field=status&sort=down">'.html_print_image('images/sort_down.png', true, ['style' => $selectstatusDown]).'</a>';
|
||||
|
||||
$table->data = [];
|
||||
|
||||
foreach ($policies as $policie) {
|
||||
$policieIDCell = "<a href='?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=".$policies['id']."'>".$policies['id'].'</a>';
|
||||
|
||||
|
||||
array_push(
|
||||
$table->data,
|
||||
[
|
||||
$policie['id'],
|
||||
$policie['name'],
|
||||
$policie['description'],
|
||||
$policie['id_group'],
|
||||
$policie['status'],
|
||||
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
$totalPolicies = count($policies);
|
||||
echo '<br />';
|
||||
ui_pagination($totalPolicies);
|
||||
html_print_table($table);
|
||||
unset($table);
|
||||
ui_pagination($totalPolicies);
|
||||
}
|
|
@ -18,7 +18,7 @@ require_once $config['homedir'].'/include/functions_reporting.php';
|
|||
enterprise_include('operation/reporting/custom_reporting.php');
|
||||
|
||||
$searchAgents = $searchAlerts = $searchModules = check_acl($config['id_user'], 0, 'AR');
|
||||
$searchUsers = check_acl($config['id_user'], 0, 'UM');
|
||||
$searchUsers = $searchPolicies = check_acl($config['id_user'], 0, 'UM');
|
||||
$searchMaps = $searchReports = $searchGraphs = check_acl($config['id_user'], 0, 'IR');
|
||||
$searchMain = true;
|
||||
$searchHelps = true;
|
||||
|
@ -43,6 +43,7 @@ if ($config['search_category'] == 'all') {
|
|||
// INI SECURITY ACL
|
||||
if ((!$searchAgents && !$searchUsers && !$searchMaps)
|
||||
|| (!$searchUsers && $searchTab == 'users')
|
||||
|| (!$searchPolicies && $searchTab == 'policies')
|
||||
|| (!$searchAgents && ($searchTab == 'agents' || $searchTab == 'alerts'))
|
||||
|| (!$searchGraphs && ($searchTab == 'graphs' || $searchTab == 'maps' || $searchTab == 'reports'))
|
||||
) {
|
||||
|
@ -161,29 +162,29 @@ if ($searchModules) {
|
|||
$modules_tab = '';
|
||||
}
|
||||
|
||||
if ($searchHelps) {
|
||||
$helps_tab = [
|
||||
'text' => "<a href='index.php?search_category=helps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".html_print_image(
|
||||
'images/help_w.png',
|
||||
if ($searchPolicies) {
|
||||
$policies_tab = [
|
||||
'text' => "<a href='index.php?search_category=policies&keywords=".$config['search_keywords']."&head_search_keywords=Search'>".html_print_image(
|
||||
'images/policies.png',
|
||||
true,
|
||||
['title' => __('Helps')]
|
||||
['title' => __('Policies')]
|
||||
).'</a>',
|
||||
'active' => $searchTab == 'helps',
|
||||
'active' => $searchTab == 'policies',
|
||||
];
|
||||
} else {
|
||||
$helps_tab = '';
|
||||
$policies_tab = '';
|
||||
}
|
||||
|
||||
$onheader = [
|
||||
'main' => $main_tab,
|
||||
'agents' => $agents_tab,
|
||||
'modules' => $modules_tab,
|
||||
'alerts' => $alerts_tab,
|
||||
'users' => $users_tab,
|
||||
'graphs' => $graphs_tab,
|
||||
'reports' => $reports_tab,
|
||||
'maps' => $maps_tab,
|
||||
'helps' => $helps_tab,
|
||||
'main' => $main_tab,
|
||||
'agents' => $agents_tab,
|
||||
'modules' => $modules_tab,
|
||||
'alerts' => $alerts_tab,
|
||||
'users' => $users_tab,
|
||||
'graphs' => $graphs_tab,
|
||||
'reports' => $reports_tab,
|
||||
'maps' => $maps_tab,
|
||||
'policies' => $policies_tab,
|
||||
];
|
||||
|
||||
ui_print_page_header(
|
||||
|
@ -251,8 +252,8 @@ switch ($searchTab) {
|
|||
include_once 'search_modules.php';
|
||||
break;
|
||||
|
||||
case 'helps':
|
||||
include_once 'search_helps.getdata.php';
|
||||
include_once 'search_helps.php';
|
||||
case 'policies':
|
||||
include_once 'search_policies.getdata.php';
|
||||
include_once 'search_policies.php';
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue