2019-06-04 11:44:11 +02:00
|
|
|
<?php
|
|
|
|
|
2023-06-08 13:19:01 +02:00
|
|
|
// Pandora FMS - https://pandorafms.com
|
2019-06-04 11:44:11 +02:00
|
|
|
// ==================================================
|
2023-06-08 11:53:13 +02:00
|
|
|
// Copyright (c) 2005-2023 Pandora FMS
|
2023-06-08 13:19:01 +02:00
|
|
|
// Please see https://pandorafms.com/community/ for full contribution list
|
2019-06-04 11:44:11 +02:00
|
|
|
// 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;
|
|
|
|
|
2019-06-04 17:05:17 +02:00
|
|
|
enterprise_include_once('include/functions_policies.php');
|
2019-06-04 11:44:11 +02:00
|
|
|
require_once $config['homedir'].'/enterprise/include/functions_groups.php';
|
|
|
|
|
2019-07-11 17:28:22 +02:00
|
|
|
$searchpolicies = check_acl($config['id_user'], 0, 'AW');
|
2019-06-04 11:44:11 +02:00
|
|
|
|
|
|
|
if (!$policies || !$searchpolicies) {
|
|
|
|
echo "<br><div class='nf'>".__('Zero results found')."</div>\n";
|
|
|
|
} else {
|
2022-02-07 13:48:25 +01:00
|
|
|
$table = new stdClass();
|
2019-06-04 11:44:11 +02:00
|
|
|
$table->cellpadding = 4;
|
|
|
|
$table->cellspacing = 4;
|
|
|
|
$table->width = '98%';
|
|
|
|
$table->class = 'databox';
|
|
|
|
|
|
|
|
$table->align = [];
|
|
|
|
$table->align[4] = 'center';
|
|
|
|
|
|
|
|
$table->head = [];
|
2019-07-10 17:58:52 +02:00
|
|
|
// $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[0] = __('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[1] = __('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[2] = __('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[3] = __('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>';
|
2019-06-04 11:44:11 +02:00
|
|
|
|
|
|
|
$table->data = [];
|
|
|
|
|
|
|
|
foreach ($policies as $policie) {
|
|
|
|
$policieIDCell = "<a href='?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=".$policies['id']."'>".$policies['id'].'</a>';
|
|
|
|
|
2019-07-10 17:58:52 +02:00
|
|
|
switch ($policie['status']) {
|
|
|
|
case POLICY_UPDATED:
|
|
|
|
$status = html_print_image(
|
2024-03-20 12:56:30 +01:00
|
|
|
'images/policies_ok.svg',
|
2019-07-10 17:58:52 +02:00
|
|
|
true,
|
2024-03-20 12:56:30 +01:00
|
|
|
[
|
|
|
|
'title' => __('Policy updated'),
|
|
|
|
'class' => 'main_menu_icon',
|
|
|
|
]
|
2019-07-10 17:58:52 +02:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POLICY_PENDING_DATABASE:
|
|
|
|
$status = html_print_image(
|
2024-03-20 12:56:30 +01:00
|
|
|
'images/policies_error_db.svg',
|
2019-07-10 17:58:52 +02:00
|
|
|
true,
|
2024-03-20 12:56:30 +01:00
|
|
|
[
|
|
|
|
'title' => __('Pending update policy only database'),
|
|
|
|
'class' => 'main_menu_icon',
|
|
|
|
]
|
2019-07-10 17:58:52 +02:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POLICY_PENDING_ALL:
|
|
|
|
$status = html_print_image(
|
2024-03-20 12:56:30 +01:00
|
|
|
'images/policies_error.svg',
|
2019-07-10 17:58:52 +02:00
|
|
|
true,
|
2024-03-20 12:56:30 +01:00
|
|
|
[
|
|
|
|
'title' => __('Pending update policy'),
|
|
|
|
'class' => 'main_menu_icon',
|
|
|
|
]
|
2019-07-10 17:58:52 +02:00
|
|
|
);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$url = $config['homeurl'].'/index.php?'.'sec=gmodules&'.'sec2=enterprise/godmode/policies/policies&id='.$policie['id'].'';
|
2019-06-04 11:44:11 +02:00
|
|
|
|
|
|
|
array_push(
|
|
|
|
$table->data,
|
|
|
|
[
|
2019-07-10 17:58:52 +02:00
|
|
|
// $policie['id'],
|
|
|
|
'<a href= '.$url.'>'.$policie['name'].'',
|
2019-06-04 11:44:11 +02:00
|
|
|
$policie['description'],
|
2019-07-10 17:58:52 +02:00
|
|
|
ui_print_group_icon($policie['id_group'], true),
|
|
|
|
$status,
|
2019-06-04 11:44:11 +02:00
|
|
|
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
$totalPolicies = count($policies);
|
|
|
|
echo '<br />';
|
|
|
|
html_print_table($table);
|
|
|
|
unset($table);
|
|
|
|
ui_pagination($totalPolicies);
|
|
|
|
}
|