2010-08-31 09:27:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - http://pandorafms.com
|
|
|
|
// ==================================================
|
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,
index.php, ajax.php, operation/search_*.php, operation/menu.php,
operation/extensions.php, godmode/menu.php, godmode/extensions.php,
admin_access_logs.php: Cleaned code and updated page disclaimers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4108 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-17 23:01:01 +01:00
|
|
|
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
|
|
|
|
// Please see http://pandorafms.org for full contribution list
|
2010-08-31 09:27:22 +02:00
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,
index.php, ajax.php, operation/search_*.php, operation/menu.php,
operation/extensions.php, godmode/menu.php, godmode/extensions.php,
admin_access_logs.php: Cleaned code and updated page disclaimers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4108 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-17 23:01:01 +01:00
|
|
|
// modify it under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation; version 2
|
|
|
|
|
2010-08-31 09:27:22 +02:00
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-03-17 Raul Mateos <raulofpandora@gmail.com>
* extensions/dbmanager.php, extensions/pandora_logs.php, general/*.php,
index.php, ajax.php, operation/search_*.php, operation/menu.php,
operation/extensions.php, godmode/menu.php, godmode/extensions.php,
admin_access_logs.php: Cleaned code and updated page disclaimers.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4108 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-17 23:01:01 +01:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-08-31 09:27:22 +02:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$searchUsers = check_acl($config['id_user'], 0, "UM");
|
|
|
|
|
|
|
|
$selectUserIDUp = '';
|
|
|
|
$selectUserIDDown = '';
|
|
|
|
$selectNameUp = '';
|
|
|
|
$selectNameDown = '';
|
|
|
|
$selectEmailUp = '';
|
|
|
|
$selectEmailDown = '';
|
|
|
|
$selectLastContactUp = '';
|
|
|
|
$selectLastContactDown = '';
|
|
|
|
$selectProfileUp = '';
|
|
|
|
$selectProfileDown = '';
|
|
|
|
|
|
|
|
switch ($sortField) {
|
|
|
|
case 'id_user':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectUserIDUp = $selected;
|
|
|
|
$order = array('field' => 'id_user', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectUserIDDown = $selected;
|
|
|
|
$order = array('field' => 'id_user', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'name':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectNameUp = $selected;
|
|
|
|
$order = array('field' => 'fullname', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectNameDown = $selected;
|
|
|
|
$order = array('field' => 'fullname', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'email':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectLastContactUp = $selected;
|
|
|
|
$order = array('field' => 'email', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectEmailDown = $selected;
|
|
|
|
$order = array('field' => 'email', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'last_contact':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectLastContactUp = $selected;
|
|
|
|
$order = array('field' => 'last_connect', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectLastContactDown = $selected;
|
|
|
|
$order = array('field' => 'last_connect', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'last_contact':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectLastContactUp = $selected;
|
|
|
|
$order = array('field' => 'last_connect', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectLastContactDown = $selected;
|
|
|
|
$order = array('field' => 'last_connect', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'profile':
|
|
|
|
switch ($sort) {
|
|
|
|
case 'up':
|
|
|
|
$selectProfileUp = $selected;
|
|
|
|
$order = array('field' => 'is_admin', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
case 'down':
|
|
|
|
$selectProfileDown = $selected;
|
|
|
|
$order = array('field' => 'is_admin', 'order' => 'DESC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$selectUserIDUp = $selected;
|
|
|
|
$selectUserIDDown = '';
|
|
|
|
$selectNameUp = '';
|
|
|
|
$selectNameDown = '';
|
|
|
|
$selectEmailUp = '';
|
|
|
|
$selectEmailDown = '';
|
|
|
|
$selectLastContactUp = '';
|
|
|
|
$selectLastContactDown = '';
|
|
|
|
$selectProfileUp = '';
|
|
|
|
$selectProfileDown = '';
|
|
|
|
|
|
|
|
$order = array('field' => 'id_user', 'order' => 'ASC');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
$users = false;
|
|
|
|
if ($searchUsers) {
|
|
|
|
$sql = "SELECT id_user, fullname, firstname, lastname, middlename, email, last_connect, is_admin, comments FROM tusuario
|
|
|
|
WHERE fullname LIKE '%" . $stringSearchSQL . "%' OR
|
2010-08-31 10:00:30 +02:00
|
|
|
id_user LIKE '%" . $stringSearchSQL . "%' OR
|
2010-08-31 09:27:22 +02:00
|
|
|
firstname LIKE '%" . $stringSearchSQL . "%' OR
|
|
|
|
lastname LIKE '%" . $stringSearchSQL . "%' OR
|
|
|
|
middlename LIKE '%" . $stringSearchSQL . "%' OR
|
|
|
|
email LIKE '%" . $stringSearchSQL . "%'
|
|
|
|
ORDER BY " . $order['field'] . " " . $order['order'] . "
|
|
|
|
LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
|
|
|
|
$users = process_sql($sql);
|
|
|
|
|
|
|
|
if($users !== false) {
|
|
|
|
//Check ACLs
|
|
|
|
$users_id = array();
|
|
|
|
foreach($users as $key => $user){
|
2011-03-08 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php, include/functions_messages.php,
include/functions_exportserver.php, include/functions_reporting.php,
include/functions_gis.php, include/functions_networkmap.php,
include/functions_servers.php, include/functions_api.php,
include/fgraph.php, include/functions_agents.php, include/functions_db.php,
include/functions_alerts.php, extensions/module_groups.php,
operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/search_modules.php, operation/agentes/status_monitor.php,
operation/agentes/export_csv.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/alerts_status.php, operation/agentes/estado_agente.php,
operation/agentes/sla_view.php, operation/agentes/ver_agente.php,
operation/servers/view_server_detail.php, operation/menu.php,
operation/search_graphs.php, operation/snmpconsole/snmp_view.php,
operation/gis_maps/ajax.php, operation/events/events_rss.php,
operation/events/events_list.php, operation/search_alerts.php,
operation/search_reports.php, operation/reporting/reporting_xml.php,
operation/reporting/graph_viewer.php, operation/search_maps.php,
operation/search_users.php, mobile/operation/agents/view_agents.php,
mobile/operation/events/events.php, godmode/groups/modu_group_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/db/db_main.php, godmode/db/db_purge.php,
godmode/agentes/module_manager_editor_prediction.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/module_manager_editor.php,
godmode/agentes/planned_downtime.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/alert_list.list.php, godmode/users/configure_user.php,
godmode/massive/massive_edit_modules.php,
godmode/modules/manage_network_templates_form.php,
godmode/modules/manage_network_components_form_wmi.php,
godmode/reporting/visual_console_builder.php,
godmode/reporting/reporting_builder.item_editor.php: changed or added in
some cases the SQL queries for to be PostgreSQL standard, and cleaned source
style.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4074 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 15:26:36 +01:00
|
|
|
if (!check_acl ($config["id_user"], get_user_groups ($user["id_user"]), "UM") && $config["id_user"] != $user["id_user"]) {
|
|
|
|
unset($users[$key]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$users_id[] = $user["id_user"];
|
|
|
|
}
|
2010-08-31 09:27:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!$users_id) {
|
|
|
|
$user_condition = "";
|
2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/incidents/incident.php,
operation/agentes/status_monitor.php, operation/agentes/datos_agente.php,
operation/servers/view_server.php, operation/snmpconsole/snmp_view.php,
operation/events/events_rss.php, operation/events/events_list.php,
operation/events/events_marquee.php, operation/search_users.php,
mobile/operation/agents/monitor_status.php,
mobile/operation/agents/view_agents.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/include/functions_web.php, godmode/admin_access_logs.php,
godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php,
godmode/reporting/reporting_builder.list_items.php: changed and addded in
the source, the SQL queries for the "LIMIT x, x" to "LIMIT x OFFSET x", that
it is standard for PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4080 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 18:55:37 +01:00
|
|
|
}
|
|
|
|
else {
|
2010-08-31 09:27:22 +02:00
|
|
|
// Condition with the visible agents
|
|
|
|
$user_condition = " AND id_user IN (\"".implode('","',$users_id)."\")";
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = "SELECT COUNT(id_user) AS count FROM tusuario
|
|
|
|
WHERE (fullname LIKE '%" . $stringSearchSQL . "%' OR
|
|
|
|
firstname LIKE '%" . $stringSearchSQL . "%' OR
|
|
|
|
lastname LIKE '%" . $stringSearchSQL . "%' OR
|
|
|
|
middlename LIKE '%" . $stringSearchSQL . "%' OR
|
|
|
|
email LIKE '%" . $stringSearchSQL . "%')".$user_condition;
|
|
|
|
$totalUsers = get_db_row_sql($sql);
|
|
|
|
|
|
|
|
$totalUsers = $totalUsers['count'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$users) {
|
|
|
|
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 = array ();
|
|
|
|
$table->align[4] = "center";
|
|
|
|
|
|
|
|
$table->head = array ();
|
|
|
|
$table->head[0] = __('User ID') . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=id_user&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectUserIDUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=id_user&sort=down">' . print_image("images/sort_down.png", true, array("style"=> $selectUserIDDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[1] = __('Name') . ' ' .
|
2011-02-15 18:53:38 +01:00
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[2] = __('Email') . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=email&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectEmailUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=email&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectEmailDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[3] = __('Last contact') . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=last_contact&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectLastContactUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=last_contact&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectLastContactDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[4] = __('Profile') . ' ' .
|
2011-02-04 14:30:50 +01:00
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=profile&sort=up">' . print_image("images/sort_up.png", true, array("style" => $selectProfileUp)) . '</a>' .
|
|
|
|
'<a href="index.php?search_category=users&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=profile&sort=down">' . print_image("images/sort_down.png", true, array("style" => $selectProfileDown)) . '</a>';
|
2010-08-31 09:27:22 +02:00
|
|
|
$table->head[5] = __('Description');
|
|
|
|
|
|
|
|
$table->data = array ();
|
|
|
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
$userIDCell = "<a href='?sec=gusuarios&sec2=godmode/users/configure_user&id=" .
|
|
|
|
$user['id_user'] . "'>" . $user['id_user'] . "</a>";
|
|
|
|
|
|
|
|
if ($user["is_admin"]) {
|
|
|
|
$profileCell = print_image ("images/user_suit.png", true,
|
|
|
|
array ("alt" => __('Admin'),
|
|
|
|
"title" => __('Administrator'))).' ';
|
2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/incidents/incident.php,
operation/agentes/status_monitor.php, operation/agentes/datos_agente.php,
operation/servers/view_server.php, operation/snmpconsole/snmp_view.php,
operation/events/events_rss.php, operation/events/events_list.php,
operation/events/events_marquee.php, operation/search_users.php,
mobile/operation/agents/monitor_status.php,
mobile/operation/agents/view_agents.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/include/functions_web.php, godmode/admin_access_logs.php,
godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php,
godmode/reporting/reporting_builder.list_items.php: changed and addded in
the source, the SQL queries for the "LIMIT x, x" to "LIMIT x OFFSET x", that
it is standard for PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4080 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 18:55:37 +01:00
|
|
|
}
|
|
|
|
else {
|
2010-08-31 09:27:22 +02:00
|
|
|
$profileCell = print_image ("images/user_green.png", true,
|
|
|
|
array ("alt" => __('User'),
|
|
|
|
"title" => __('Standard User'))).' ';
|
|
|
|
}
|
|
|
|
$profileCell .= '<a href="#" class="tip"><span>';
|
|
|
|
$result = get_db_all_rows_field_filter ("tusuario_perfil", "id_usuario", $user['id_user']);
|
|
|
|
if ($result !== false) {
|
|
|
|
foreach ($result as $row) {
|
|
|
|
$profileCell .= get_profile_name ($row["id_perfil"]);
|
|
|
|
$profileCell .= " / ";
|
|
|
|
$profileCell .= get_group_name ($row["id_grupo"]);
|
|
|
|
$profileCell .= "<br />";
|
|
|
|
}
|
2011-03-09 Miguel de Dios <miguel.dedios@artica.es>
* install.php, operation/incidents/incident.php,
operation/agentes/status_monitor.php, operation/agentes/datos_agente.php,
operation/servers/view_server.php, operation/snmpconsole/snmp_view.php,
operation/events/events_rss.php, operation/events/events_list.php,
operation/events/events_marquee.php, operation/search_users.php,
mobile/operation/agents/monitor_status.php,
mobile/operation/agents/view_agents.php,
mobile/operation/agents/view_alerts.php, mobile/operation/events/events.php,
mobile/include/functions_web.php, godmode/admin_access_logs.php,
godmode/agentes/modificar_agente.php, godmode/alerts/alert_actions.php,
godmode/reporting/reporting_builder.list_items.php: changed and addded in
the source, the SQL queries for the "LIMIT x, x" to "LIMIT x OFFSET x", that
it is standard for PostgreSQL.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4080 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-03-09 18:55:37 +01:00
|
|
|
}
|
|
|
|
else {
|
2010-08-31 09:27:22 +02:00
|
|
|
$profileCell .= __('The user doesn\'t have any assigned profile/group');
|
|
|
|
}
|
|
|
|
$profileCell .= "</span></a>";
|
|
|
|
|
|
|
|
array_push($table->data, array(
|
|
|
|
$userIDCell,
|
|
|
|
$user['fullname'],
|
|
|
|
"<a href='mailto:" . $user['email'] . "'>" . $user['email'] . "</a>",
|
|
|
|
print_timestamp ($user["last_connect"], true),
|
|
|
|
$profileCell,
|
|
|
|
$user['comments']));
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<br />";pagination ($totalUsers);
|
|
|
|
print_table ($table); unset($table);
|
|
|
|
pagination ($totalUsers);
|
|
|
|
}
|
|
|
|
?>
|