2009-03-26 Esteban Sanchez <estebans@artica.es>

* godmode/users/configure_user.php: Complete rewritten to fix minor
	errors and fit the Pandora style.

	* include/auth/ldap.php: Removed process_user_isadmin(). Renamed
	process_user_password() to update_user_password(). Renamed
	process_user_info to update_user(). update_user_password() does not
	require old password anymore.

	* include/functions_db.php: Added empty checks on
	create_user_profile().

	* include/functions_ui.php: print_error_message() renamed to
	print_result_message().

	* godmode/agentes/configurar_agente.php,
	godmode/alerts/alert_actions.php, godmode/alerts/alert_commands.php,
	godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
	godmode/alerts/alert_templates.php,
	godmode/alerts/configure_alert_template.php,
	godmode/modules/manage_nc_groups.php,
	godmode/modules/manage_network_templates.php,
	godmode/modules/manage_network_templates_form.php,
	godmode/reporting/map_builder_wizard.php,
	godmode/reporting/reporting_builder.php,
	operation/agentes/alerts_status.php, operation/events/events.php,
	operation/incidents/incident.php,
	operation/incidents/incident_detail.php,
	operation/messages/message.php, operation/snmpconsole/snmp_view.php,
	operation/users/user_edit.php: Renamed print_result_message(). Some
	translatable strings reused to simplify i18n work.
	
	* godmode/users/user_list.php: Renamed print_result_message(). Use
	cross.png for deletion links. Style corrections.

	* godmode/setup/news.php: Renamed print_result_message(). Use
	process_sql_delete() instead of direct mysql_query.

	* godmode/reporting/map_builder.php: Renamed print_result_message().
	Style correction on process_sql_update().

	* godmode/alerts/configure_alert_compound.php: Renamed
	print_result_message(). Fixed steps_clean div.
	
	* godmode/setup/setup.php: Return control to index instead of exit.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1567 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-03-26 11:14:49 +00:00
parent 881041f9bc
commit fd419a8216
30 changed files with 447 additions and 293 deletions

View File

@ -1,3 +1,50 @@
2009-03-26 Esteban Sanchez <estebans@artica.es>
* godmode/users/configure_user.php: Complete rewritten to fix minor
errors and fit the Pandora style.
* include/auth/ldap.php: Removed process_user_isadmin(). Renamed
process_user_password() to update_user_password(). Renamed
process_user_info to update_user(). update_user_password() does not
require old password anymore.
* include/functions_db.php: Added empty checks on
create_user_profile().
* include/functions_ui.php: print_error_message() renamed to
print_result_message().
* godmode/agentes/configurar_agente.php,
godmode/alerts/alert_actions.php, godmode/alerts/alert_commands.php,
godmode/alerts/alert_compounds.php, godmode/alerts/alert_list.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_template.php,
godmode/modules/manage_nc_groups.php,
godmode/modules/manage_network_templates.php,
godmode/modules/manage_network_templates_form.php,
godmode/reporting/map_builder_wizard.php,
godmode/reporting/reporting_builder.php,
operation/agentes/alerts_status.php, operation/events/events.php,
operation/incidents/incident.php,
operation/incidents/incident_detail.php,
operation/messages/message.php, operation/snmpconsole/snmp_view.php,
operation/users/user_edit.php: Renamed print_result_message(). Some
translatable strings reused to simplify i18n work.
* godmode/users/user_list.php: Renamed print_result_message(). Use
cross.png for deletion links. Style corrections.
* godmode/setup/news.php: Renamed print_result_message(). Use
process_sql_delete() instead of direct mysql_query.
* godmode/reporting/map_builder.php: Renamed print_result_message().
Style correction on process_sql_update().
* godmode/alerts/configure_alert_compound.php: Renamed
print_result_message(). Fixed steps_clean div.
* godmode/setup/setup.php: Return control to index instead of exit.
2009-03-25 Evi Vanoost <vanooste@rcbi.rochester.edu>
* operation/incidents/incident.php: Fixed small issue

View File

@ -230,7 +230,9 @@ echo '<div style="height: 25px;">&nbsp;</div>';
// Show agent creation results
if ($create_agent) {
print_error_message ($agent_created_ok, __('Agent successfully created'), __('There was a problem creating the agent'));
print_result_message ($agent_created_ok,
__('Agent successfully created'),
__('There was a problem creating the agent'));
}
// Fix / Normalize module data
@ -250,7 +252,9 @@ if (isset($_GET["fix_module"])){
$error = " - ".__('No data to normalize');
}
print_error_message ($result, __('Deleted data above').' '.$media, __('Error normalizing module').' '.$error);
print_result_message ($result,
__('Deleted data above %d', $media),
__('Error normalizing module %s', $error));
}
// ================

View File

@ -59,7 +59,8 @@ if ($create_action) {
'field2' => $field2,
'field3' => $field3));
print_error_message ($result, __('Successfully created'),
print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
}
@ -79,7 +80,8 @@ if ($update_action) {
$values['field3'] = $field3;
$result = update_alert_action ($id, $values);
print_error_message ($result, __('Successfully updated'),
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
}
@ -88,7 +90,8 @@ if ($delete_action) {
$result = delete_alert_action ($id);
print_error_message ($result, __('Successfully deleted'),
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}

View File

@ -52,7 +52,8 @@ if ($create_command) {
$result = create_alert_command ($name, $command,
array ('description' => $description));
print_error_message ($result, __('Successfully created'),
print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
}
@ -74,7 +75,8 @@ if ($update_command) {
$values['description'] = $description;
$result = update_alert_command ($id, $values);
print_error_message ($result, __('Successfully updated'),
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
}
@ -91,7 +93,8 @@ if ($delete_command) {
$result = delete_alert_command ($id);
print_error_message ($result, __('Successfully deleted'),
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}

View File

@ -48,7 +48,8 @@ $disable_alert = (int) get_parameter ('disable_alert');
if ($delete_alert) {
$id = (int) get_parameter ('id');
$result = delete_alert_compound ($id);
print_error_message ($result, __('Successfully deleted'),
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
if (is_ajax ())
return;
@ -57,7 +58,8 @@ if ($delete_alert) {
if ($enable_alert) {
$id = (int) get_parameter ('id');
$result = set_alerts_compound_disable ($id, false);
print_error_message ($result, __('Successfully enabled'),
print_result_message ($result,
__('Successfully enabled'),
__('Could not be enabled'));
if (is_ajax ())
return;
@ -66,7 +68,8 @@ if ($enable_alert) {
if ($disable_alert) {
$id = (int) get_parameter ('id');
$result = set_alerts_compound_disable ($id, true);
print_error_message ($result, __('Successfully disabled'),
print_result_message ($result,
__('Successfully disabled'),
__('Could not be disabled'));
if (is_ajax ())
return;

View File

@ -112,7 +112,8 @@ if ($create_alert) {
$id_agent_module = (int) get_parameter ('id_agent_module');
$id = create_alert_agent_module ($id_agent_module, $id_alert_template);
print_error_message ($id, __('Successfully created'),
print_result_message ($id,
__('Successfully created'),
__('Could not be created'));
if ($id !== false) {
$actions = (array) get_parameter ('actions');
@ -134,7 +135,8 @@ if ($delete_alert) {
$id_alert_agent_module = (int) get_parameter ('id_alert');
$result = delete_alert_agent_module ($id_alert_agent_module);
print_error_message ($id, __('Successfully deleted'),
print_result_message ($id,
__('Successfully deleted'),
__('Could not be deleted'));
}
@ -150,7 +152,8 @@ if ($add_action) {
$values['fires_max'] = $fires_max;
$result = add_alert_agent_module_action ($id_alert_module, $id_action, $values);
print_error_message ($id, __('Successfully added'),
print_result_message ($id,
__('Successfully added'),
__('Could not be added'));
}
@ -159,7 +162,8 @@ if ($delete_action) {
$id_alert = (int) get_parameter ('id_alert');
$result = delete_alert_agent_module_action ($id_action);
print_error_message ($id, __('Successfully deleted'),
print_result_message ($id,
__('Successfully deleted'),
__('Could not be deleted'));
}
@ -167,7 +171,8 @@ if ($enable_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_disable ($id_alert, false);
print_error_message ($result, __('Successfully enabled'),
print_result_message ($result,
__('Successfully enabled'),
__('Could not be enabled'));
}
@ -175,7 +180,8 @@ if ($disable_alert) {
$id_alert = (int) get_parameter ('id_alert');
$result = set_alerts_agent_module_disable ($id_alert, true);
print_error_message ($result, __('Successfully disabled'),
print_result_message ($result,
__('Successfully disabled'),
__('Could not be disabled'));
}

View File

@ -118,7 +118,8 @@ if ($update_template) {
'field2_recovery' => $field2_recovery,
'field3_recovery' => $field3_recovery));
print_error_message ($result, __('Successfully updated'),
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
}
@ -127,7 +128,8 @@ if ($delete_template) {
$result = delete_alert_template ($id);
print_error_message ($result, __('Successfully deleted'),
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}

View File

@ -89,7 +89,7 @@ function print_alert_compound_steps ($step, $id) {
}
echo '</ol>';
echo '<div class="steps_clean"> </div>';
echo '<div id="steps_clean"> </div>';
}
function update_compound ($step) {
@ -242,7 +242,8 @@ if ($create_compound) {
$result = create_alert_compound ($name, $id_agent,
array ('description' => $description));
print_error_message ($result, __('Successfully created'),
print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
/* Go to previous step in case of error */
if ($result === false) {
@ -261,7 +262,8 @@ if ($create_compound) {
if ($update_compound) {
$result = update_compound ($step - 1);
print_error_message ($result, __('Successfully updated'),
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
/* Go to previous step in case of error */
if ($result === false) {

View File

@ -36,7 +36,7 @@ if ($duplicate_template) {
$source_id = (int) get_parameter ('source_id');
$id = duplicate_alert_template ($source_id);
print_error_message ($id,
print_result_message ($id,
__('Successfully created from %s', get_alert_template_name ($source_id)),
__('Could not be created'));
}
@ -239,7 +239,8 @@ if ($create_template) {
'min_value' => $min,
'matches_value' => $matches));
print_error_message ($result, __('Successfully created'),
print_result_message ($result,
__('Successfully created'),
__('Could not be created'));
/* Go to previous step in case of error */
if ($result === false)
@ -251,7 +252,8 @@ if ($create_template) {
if ($update_template) {
$result = update_template ($step - 1);
print_error_message ($result, __('Successfully updated'),
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
/* Go to previous step in case of error */
if ($result === false) {

View File

@ -41,7 +41,7 @@ if ($create) {
$result = process_sql_insert ('tnetwork_component_group',
array ('name' => $name,
'parent' => $parent));
print_error_message ($result,
print_result_message ($result,
__('Created successfully'),
__('Not created. Error inserting data'));
}
@ -55,7 +55,7 @@ if ($update) {
array ('name' => $name,
'parent' => $parent),
array ('id_sg' => $id));
print_error_message ($result,
print_result_message ($result,
__('Updated successfully'),
__('Not updated. Error updating data'));
}
@ -65,7 +65,7 @@ if ($delete) { // if delete
$result = process_sql_delete ('tnetwork_component_group',
array ('id_sg' => $id));
print_error_message ($result,
print_result_message ($result,
__('Deleted successfully'),
__('Not deleted. Error deleting data'));
}

View File

@ -33,7 +33,9 @@ if (isset ($_POST["delete_profile"])) { // if delete
$id_np = (int) get_parameter_post ("delete_profile", 0);
$sql = sprintf ("DELETE FROM tnetwork_profile WHERE id_np = %d", $id_np);
$result = process_sql ($sql);
print_error_message ($result, __('Template successfully deleted'), __('Error deleting template'));
print_result_message ($result,
__('Template successfully deleted'),
__('Error deleting template'));
}
if (isset ($_POST["export_profile"])) {
@ -41,7 +43,7 @@ if (isset ($_POST["export_profile"])) {
$profile_info = get_db_row ("tnetwork_profile", "id_np", $id_np);
if (empty ($profile_info)) {
print_error_message (false,'', __('This template does not exist'));
print_result_message (false, '', __('This template does not exist'));
return;
}

View File

@ -44,7 +44,9 @@ if (isset ($_GET["delete_module"])) {
}
}
print_error_message (($errors < 1), __('Successfully deleted module from profile'), __('Error deleting module from profile'));
print_result_message (($errors < 1),
__('Successfully deleted module from profile'),
__('Error deleting module from profile'));
} elseif (isset ($_GET["add_module"])) {
// Add module to profile
$errors = 0;
@ -56,7 +58,9 @@ if (isset ($_GET["delete_module"])) {
}
}
print_error_message (($errors < 1), __('Successfully added module to profile'), __('Error adding module to profile'));
print_result_message (($errors < 1),
__('Successfully added module to profile'),
__('Error adding module to profile'));
}
if (isset ($_GET["create"]) || isset ($_GET["update"])) {
@ -68,12 +72,16 @@ if (isset ($_GET["create"]) || isset ($_GET["update"])) {
//Profile exists
$sql = sprintf ("UPDATE tnetwork_profile SET name = '%s', description = '%s' WHERE id_np = %d", $name, $description, $id_np);
$result = process_sql ($sql);
print_error_message ($result, __('Successfully updated network profile'), __('Error updating network profile'));
print_result_message ($result,
__('Successfully updated network profile'),
__('Error updating network profile'));
} else {
//Profile doesn't exist
$sql = sprintf ("INSERT INTO tnetwork_profile (name, description) VALUES ('%s', '%s')", $name, $description);
$result = process_sql ($sql, "insert_id");
print_error_message ($result, __('Successfully added network profile'), __('Error adding network profile'));
print_result_message ($result,
__('Successfully added network profile'),
__('Error adding network profile'));
$id_np = (int) $result; //Will return either 0 (in case of error) or an int
}

View File

@ -101,9 +101,17 @@ if ($update_layout) {
if (! $height)
$height = $bg_info[1];
$result = process_sql_update ('tlayout', array ('name' => $name, 'background' => $background, 'height' => $height, 'width' => $width, 'id_group' => $id_group), array ('id' => $id_layout));
$values = array ('name' => $name,
'background' => $background,
'height' => $height,
'width' => $width,
'id_group' => $id_group);
$result = process_sql_update ('tlayout', $values, array ('id' => $id_layout));
print_error_message ($result, __('Update layout successful'), __('Update layout failed'));
print_result_message ($result,
__('Update layout successful'),
__('Update layout failed'));
if (is_ajax ()) {
exit;

View File

@ -30,7 +30,7 @@ $layout_id = (int) get_parameter ('id_layout');
$layout = get_db_row ('tlayout', 'id', $layout_id);
if (empty ($layout)) {
print_error_message (false, '', __('No layout with this id found'));
print_result_message (false, '', __('No layout with this id found'));
return;
}
@ -44,7 +44,7 @@ if (! give_acl ($config['id_user'], $layout_group, "AW")) {
function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0, $height = 0) {
if (empty ($id_agents)) {
print_error_message (false, '', __('No agents selected'));
print_result_message (false, '', __('No agents selected'));
return false;
}
@ -74,13 +74,13 @@ function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0,
$pos_x = $pos_x + $range;
}
print_error_message (true, __('Agent successfully added to layout'), '');
print_result_message (true, __('Agent successfully added to layout'), '');
echo '<h3><a href="index.php?sec=greporting&sec2=godmode/reporting/map_builder&id_layout='.$id_layout.'">'.__('Map builder').'</a></h3>';
}
function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $width = 0, $height = 0) {
if (empty ($id_modules)) {
print_error_message (false, '', __('No modules selected'));
print_result_message (false, '', __('No modules selected'));
return false;
}
@ -114,7 +114,7 @@ function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $w
$pos_x = $pos_x + $range;
}
print_error_message (true, __('Modules successfully added to layout'), '');
print_result_message (true, __('Modules successfully added to layout'), '');
}
echo '<h2>'.__('Visual map wizard').' - '.$layout["name"].'</h2>';
@ -187,4 +187,4 @@ echo '</form>';
$(document).ready (function () {
$("#id_agents").change (agent_changed);
});
</script>
</script>

View File

@ -64,7 +64,7 @@ if ($delete_report_content) {
$id_report_content = (int) get_parameter ('id_report_content');
$result = delete_report_content ($id_report_content);
print_error_message ($result,
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}
@ -84,7 +84,7 @@ if ($content_down) {
// Delete report SQL code
if ($delete_report) {
$result = delete_report ($id_report);
print_error_message ($result,
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
$id_report = 0;
@ -137,7 +137,7 @@ if ($create_report) {
$values['description'] = $report_description;
$values['private'] = $report_private;
$id_report = create_report ($name, $id_group, $values);
print_error_message ($id_report,
print_result_message ($id_report,
__('Successfully created'),
__('Could not be created'));
}
@ -149,7 +149,7 @@ if ($update_report) {
$values['description'] = $report_description;
$values['private'] = $report_private;
$result = update_report ($id_report, $values);
print_error_message ($result,
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
}
@ -376,7 +376,7 @@ if ($edit_sla_report_content) {
$modules = array ();
if ($id_agent) {
$modules = get_db_all_rows_filter ('tagente_modulo',
array ('id_agente' => $id_agent, 'order' => 'nombre');
array ('id_agente' => $id_agent, 'order' => 'nombre'),
array ('id_agente_modulo', 'nombre'));
}
$table->data[3][1] = print_select ($modules, 'id_module', 0, '', '--', 0, true);

View File

@ -35,7 +35,9 @@ if (isset ($_POST["create"])) { // If create
$sql = sprintf ("INSERT INTO tnews (subject, text, author, timestamp) VALUES ('%s', '%s', '%s', NOW()) ", $subject, $text, $config["id_user"]);
$id_link = process_sql ($sql, "insert_id");
print_error_message ($id_link, __('Created successfully'), __('Not created. Error inserting data'));
print_result_message ($id_link,
__('Created successfully'),
__('Not created. Error inserting data'));
}
if (isset ($_POST["update"])) { // if update
@ -47,17 +49,19 @@ if (isset ($_POST["update"])) { // if update
$result = process_sql ($sql);
print_error_message ($result, __('Updated successfully'), __('Not updated. Error updating data'));
print_result_message ($result,
__('Updated successfully'),
__('Not updated. Error updating data'));
}
if (isset ($_GET["borrar"])) { // if delete
$id_news = (int) get_parameter ("borrar", 0);
$sql = sprintf ("DELETE FROM tnews WHERE id_news = %d", $id_news);
$result = process_sql_delete ('tnews', array ('id_news' => $id_news));
$result = mysql_query ($sql);
print_error_message ($result, __('Deleted successfully'), __('Not deleted. Error deleting data'));
print_result_message ($result,
__('Deleted successfully'),
__('Could not be deleted'));
}
// Main form view for Links edit

View File

@ -24,7 +24,7 @@ check_login ();
if (! give_acl ($config['id_user'], 0, "PM") || ! is_user_admin ($config['id_user'])) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
exit;
return;
}
// Load enterprise extensions

View File

@ -17,13 +17,12 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require_once ("include/config.php");
require_once ('include/config.php');
check_login ();
$id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter
$id = get_parameter ('id', $config['id_user']); // ID given as parameter
$user_info = get_user_info ($id);
$id = $user_info["id_user"];
$id = $user_info['id_user'];
if (! give_acl ($config['id_user'], 0, "UM")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
@ -32,202 +31,260 @@ if (! give_acl ($config['id_user'], 0, "UM")) {
exit;
}
if ($config["user_can_update_info"]) {
if ($config['user_can_update_info']) {
$view_mode = false;
} else {
$view_mode = true;
}
if (isset ($_GET["create"]) && $config["admin_can_add_user"]) {
$new_user = (bool) get_parameter ('new_user');
$create_user = (bool) get_parameter ('create_user');
$add_profile = (bool) get_parameter ('add_profile');
$delete_profile = (bool) get_parameter ('delete_profile');
$update_user = (bool) get_parameter ('update_user');
if ($create_user) {
if (! $config['admin_can_add_user']) {
print_result_message (false, '',
__('The current authentication scheme doesn\'t support creating users from Pandora FMS'));
return;
}
$values = array ();
$values['fullname'] = (string) get_parameter ('fullname');
$values['firstname'] = (string) get_parameter ('firstname');
$values['lastname'] = (string) get_parameter ('lastname');
$password_new = (string) get_parameter ('password_new');
$password_confirm = (string) get_parameter ('password_confirm');
$values['email'] = (string) get_parameter ('email');
$values['phone'] = (string) get_parameter ('phone');
$values['comments'] = (string) get_parameter ('comments');
$is_admin = (bool) get_parameter ('is_admin', 0);
if ($password_new == '') {
print_result_message (false, '', __('Passwords cannot be empty'));
$user_info = $values;
$password_new = '';
$password_confirm = '';
} elseif ($password_new != $password_confirm) {
print_result_message (false, '', __('Passwords didn\'t match'));
$user_info = $values;
$password_new = '';
$password_confirm = '';
} else {
$id = (string) get_parameter ('id_user');
$result = create_user ($id, $password_new, $values);
print_result_message ($result,
__('User successfully created'),
__('Error creating user'));
$user_info = get_user_info ($id);
$password_new = '';
$password_confirm = '';
}
}
if ($update_user) {
$values = array ();
$values['fullname'] = (string) get_parameter ('fullname');
$values['firstname'] = (string) get_parameter ('firstname');
$values['lastname'] = (string) get_parameter ('lastname');
$values['email'] = (string) get_parameter ('email');
$values['phone'] = (string) get_parameter ('phone');
$values['comments'] = (string) get_parameter ('comments');
$values['is_admin'] = (bool) get_parameter ('is_admin');
$res1 = update_user ($id, $values);
if ($config['user_can_update_password']) {
$password_new = (string) get_parameter ('password_new');
$password_confirm = (string) get_parameter ('password_confirm');
if ($password_new !== '') {
if ($password_confirm == $password_new) {
$res2 = update_user_password ($id, $password_new);
print_result_message ($res1 || $res2,
__('User info successfully updated'),
__('Error updating user info (no change?)'));
} else {
print_result_message (false, '',
__('Passwords does not match'));
}
} else {
print_result_message ($res1,
__('User info successfully updated'),
__('Error updating user info (no change?)'));
}
} else {
print_result_message ($res1,
__('User info successfully updated'),
__('Error updating user info (no change?)'));
}
$user_info = $values;
}
if ($new_user && $config['admin_can_add_user']) {
$user_info = array ();
$id = '';
$user_info["fullname"] = '';
$user_info["firstname"] = '';
$user_info["lastname"] = '';
$user_info["email"] = '';
$user_info["phone"] = '';
$user_info["comments"] = '';
$user_info["is_admin"] = 0;
} elseif (isset ($_GET["create"])) {
print_error_message (false, '', __('The current authentication scheme doesn\'t support creating users from Pandora FMS'));
} elseif (isset ($_GET["user_mod"])) {
$mod = get_parameter_get ("user_mod", 0); //0 is no user info modify (can modify passwords and admin status), 1 is modify, 2 is create
$user_info['fullname'] = '';
$user_info['firstname'] = '';
$user_info['lastname'] = '';
$user_info['email'] = '';
$user_info['phone'] = '';
$user_info['comments'] = '';
$user_info['is_admin'] = 0;
}
if ($add_profile) {
$group = (int) get_parameter ('assign_group');
$profile = (int) get_parameter ('assign_profile');
$upd_info = array ();
$upd_info["fullname"] = get_parameter_post ("fullname");
$upd_info["firstname"] = get_parameter_post ("firstname");
$upd_info["lastname"] = get_parameter_post ("lastname");
$password_old = get_parameter_post ("password_old", "-");
$password_new = get_parameter_post ("password_new", "-");
$password_confirm = get_parameter_post ("password_confirm", "-");
$upd_info["email"] = get_parameter_post ("email");
$upd_info["phone"] = get_parameter_post ("phone");
$upd_info["comments"] = get_parameter_post ("comments");
$is_admin = get_parameter_post ("is_admin", 0);
$group = get_parameter_post ("assign_group", 0);
$profile = get_parameter_post ("assign_profile", 0);
$return = create_user_profile ($id, $profile, $group);
print_result_message ($return,
__('Succesfully created'),
__('Could not be created'));
}
if ($delete_profile) {
$id_up = (int) get_parameter ('id_user_profile');
if ($config["admin_can_add_user"] && $mod == 2) {
if ($password_new != $password_confirm) {
print_error_message (false, '', __('Passwords didn\t match'));
$id = '';
$user_info = $upd_info; //Fill in the blanks again
$user_info["is_admin"] = $is_admin;
$_GET["create"] = 1; //Set create mode back on
$password_old = "-";
$password_new = "-";
$password_confirm = "-";
} else {
$id = get_parameter_post ("id_user");
$return = create_user ($id, $password_new, $upd_info);
print_error_message ($return, __('User successfully created'), __('Error creating user'));
$user_info = get_user_info ($id);
$id = $user_info["id_user"];
$password_old = "-";
$password_new = "-";
$password_confirm = "-";
}
} elseif ($config["user_can_update_info"] && $mod == 1) {
$return = process_user_info ($id, $upd_info);
print_error_message ($return, __('User info successfully updated'), __('Error updating user info (no change?)'));
$user_info = $upd_info;
$user_info["is_admin"] = $is_admin;
}
//If User can update password and the new password is not the same as the old one, it's not the default and it's not empty and the new password is the same as the confirmed one
if ($config["user_can_update_password"] && $password_old !== $password_new && $password_new !== "-" && !empty ($password_new) && $password_confirm == $password_new) {
$return = process_user_password ($id, $password_old, $password_new);
print_error_message ($return, __('Password successfully updated'), __('Error updating passwords').": ".$config["auth_error"]);
} elseif ($password_new !== "-") {
print_error_message (false, '', __('Passwords didn\'t match or other problem encountered while updating passwords'));
}
if ($is_admin != $user_info["is_admin"]) {
$return = process_user_isadmin ($id, $is_admin);
print_error_message ($return, __('User admin status succesfully update'), __('Error updating admin status'));
}
if ($group != 0 && $profile != 0) {
$return = create_user_profile ($id, $profile, $group);
print_error_message ($return, __('User profile succesfully created'), __('Error creating user profile'));
}
} elseif (isset ($_GET["profile_mod"])) {
$id_up = (int) get_parameter_post ("delete_profile", 0);
$return = delete_user_profile ($id, $id_up);
print_error_message ($return, __('Profile successfully deleted'), __('Error deleting profile'));
print_result_message ($return,
__('Successfully deleted'),
__('Could not be deleted'));
}
echo "<h2>".__('Pandora users')." &gt; ".__('User detail editor')."</h2>";
if (!empty ($id)) {
echo '<form name="user_mod" method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_user&id='.$id.'&user_mod=1">';
} else {
echo '<form name="user_create" method="post" action="index.php?sec=gusuarios&sec2=godmode/users/configure_user&user_mod=2">';
$table->width = '50%';
$table->data = array ();
$table->colspan = array ();
$table->size = array ();
$table->size[0] = '35%';
$table->size[1] = '65%';
$table->style = array ();
$table->style[0] = 'font-weight: bold; vertical-align: top';
$table->data[0][0] = __('User ID');
$table->data[0][1] = print_input_text_extended ('id_user', $id, '', '', 20, 60,
$view_mode, '', '', true);
$table->data[1][0] = __('Full (display) name');
$table->data[1][1] = print_input_text_extended ('fullname', $user_info['fullname'],
'', '', 30, 255, $view_mode, '', '', true);
$table->data[2][0] = __('First name');
$table->data[2][1] = print_input_text_extended ('firstname', $user_info['firstname'],
'', '', 30, 255, $view_mode, '', '', true);
$table->data[3][0] = __('Last name');
$table->data[3][1] = print_input_text_extended ('lastname', $user_info['lastname'],
'', '', 30, 255, $view_mode, '', '', true);
if ($config['user_can_update_password']) {
$table->data[4][0] = __('Password');
$table->data[4][1] = print_input_text_extended ('password_new', '', '', '',
15, 255, $view_mode, '', '', true, true);
$table->data[5][0] = __('Password confirmation');
$table->data[5][1] = print_input_text_extended ('password_confirm', '', '',
'', 15, 255, $view_mode, '', '', true, true);
}
echo '<table cellpadding="4" cellspacing="4" class="databox_color" width="600px">';
if ($config['admin_can_make_admin']) {
$table->data[6][0] = __('Global Profile');
$table->data[6][1] = print_radio_button ('is_admin', 1, '', $user_info['is_admin'], true);
$table->data[6][1] .= __('Administrator');
$table->data[6][1] .= print_help_tip (__("This user has permissions to manage all. This is admin user and overwrites all permissions given in profiles/groups"), true);
$table->data[6][1] .= '<br />';
$table->data[6][1] .= print_radio_button ('is_admin', 0, '', $user_info['is_admin'], true);
$table->data[6][1] .= __('Standard user');
$table->data[6][1] .= print_help_tip (__("This user has separated permissions to view data in his group agents, create incidents belong to his groups, add notes in another incidents, create personal assignments or reviews and other tasks, on different profiles"), true);
}
echo '<tr><td class="datos">'.__('User ID').'</td>';
echo '<td class="datos">';
print_input_text_extended ("id_user", $id, '', '', '', '', $view_mode, '', 'class="input"');
$table->data[7][0] = __('E-mail');
$table->data[7][1] = print_input_text_extended ("email", $user_info['email'],
'', '', 20, 100, $view_mode, '', '', true);
echo '</td></tr><tr><td class="datos2">'.__('Full (display) name').'</td><td class="datos2">';
print_input_text_extended ("fullname", $user_info["fullname"], '', '', '', '', $view_mode, '', 'class="input"');
$table->data[8][0] = __('Phone number');
$table->data[8][1] = print_input_text_extended ("phone", $user_info['phone'],
'', '', 10, 30, $view_mode, '', '', true);
echo '</td></tr><tr><td class="datos">'.__('First name').'</td><td class="datos">';
print_input_text_extended ("firstname", $user_info["firstname"], '', '', '', '', $view_mode, '', 'class="input"');
$table->data[9][0] = __('Comments');
$table->data[9][1] = print_textarea ("comments", 5, 55, $user_info['comments'],
($view_mode ? 'readonly="readonly"' : ''), true);
echo '</td></tr><tr><td class="datos2">'.__('Last name').'</td><td class="datos2">';
print_input_text_extended ("lastname", $user_info["lastname"], '', '', '', '', $view_mode, '', 'class="input"');
echo '<form method="post">';
echo '</td></tr><tr><td class="datos">'.__('Password').'</td><td class="datos">';
if ($config["user_can_update_password"]) {
if (!isset ($_GET["create"])) {
print_input_text_extended ("password_old", "-", '', '', '', '', $view_mode, '', 'class="input"', false, true);
print_table ($table);
echo '<div style="width: '.$table->width.'" class="action-buttons">';
if ($new_user) {
if ($config['admin_can_add_user']){
print_input_hidden ('create_user', 1);
print_submit_button (__('Create'), 'crtbutton', false, 'class="sub wand"');
}
echo '</td></tr><tr><td class="datos">'.__('New Password').'</td><td class="datos">';
print_input_text_extended ("password_new", "-", '', '', '', '', $view_mode, '', 'class="input"', false, true);
echo '</td></tr><tr><td class="datos">'.__('Password confirmation').'</td><td class="datos">';
print_input_text_extended ("password_confirm", "-", '', '', '', '', $view_mode, '', 'class="input"', false, true);
} else {
echo '<i>'.__('You can not change passwords from Pandora FMS under the current authentication scheme').'</i>';
if ($config['user_can_update_info']) {
print_input_hidden ('update_user', 1);
print_submit_button (__('Update'), 'uptbutton', false, 'class="sub upd"');
}
}
echo '</div>';
echo '</form>';
echo '<br />';
echo '</td></tr><tr><td class="datos2">'.__('Global Profile').'</td><td class="datos2">';
if ($config["admin_can_make_admin"]) {
echo __('Administrator');
print_radio_button ('is_admin', '1', '', $user_info["is_admin"]);
print_help_tip (__("This user has permissions to manage all. This is admin user and overwrites all permissions given in profiles/groups"));
print __('Standard user');
print_radio_button ('is_admin', '0', '', $user_info["is_admin"]);
print_help_tip (__("This user has separated permissions to view data in his group agents, create incidents belong to his groups, add notes in another incidents, create personal assignments or reviews and other tasks, on different profiles"));
} else {
echo '<i>'.__('You can not change admin status from Pandora FMS under the current authentication scheme').'</i>';
}
echo '</td></tr><tr><td class="datos">'.__('E-mail').'</td><td class="datos">';
print_input_text_extended ("email", $user_info["email"], '', '', '', '', $view_mode, '', 'class="input"');
echo '</td></tr><tr><td class="datos2">'.__('Phone number').'</td><td class="datos2">';
print_input_text_extended ("phone", $user_info["phone"], '', '', '', '', $view_mode, '', 'class="input"');
echo '</td></tr><tr><td class="datos">'.__('Comments').'</td><td class="datos">';
print_textarea ("comments", 4, 55, $user_info["comments"], ($view_mode ? 'readonly' : ''));
echo '<tr><td class="datos2">'.__('Group(s) available').'</td><td class="datos2">';
$groups = get_user_groups ($config["id_user"], "UM");
print_select ($groups, "assign_group", 0, '', __('None'), 0, false, false, false, 'w155');
echo '</td></tr><tr><td class="datos">'.__('Profiles').'</td><td class="datos">';
$profiles = get_profiles ();
print_select ($profiles, "assign_profile", 0, '', __('None'), 0, false, false, false, 'w155');
echo '</td></tr></table>';
echo '<div style="width:600px; text-align:right;">';
print_submit_button (__('Update'), 'uptbutton', false, 'class="sub upd"');
echo '</div></form><br />';
/* Don't show anything else if we're creating an user */
if (empty ($id) || $new_user)
return;
echo '<h3>'.__('Profiles/Groups assigned to this user').'</h3>';
$table->width = 600;
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->class = "databox";
$table->width = '50%';
$table->data = array ();
$table->head = array ();
$table->align = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->style[1] = 'font-weight: bold';
$table->head[0] = __('Profile name');
$table->head[1] = __('Group name');
$table->head[2] = '';
$table->align[0] = 'center';
$table->align[1] = 'center';
$table->align[2] = 'center';
$result = get_db_all_rows_field_filter ("tusuario_perfil", "id_usuario", $id);
if ($result === false) {
$result = array ();
}
foreach ($result as $profile) {
$data[0] = '<b><a href="index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&id='.$profile["id_perfil"].'">'.get_profile_name ($profile["id_perfil"]).'</a></b>';
$data[1] = '<b><a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$profile["id_grupo"].'">'.get_group_name ($profile["id_grupo"]).'</a></b>';
$data[2] = print_input_image ("delete_profile", "images/delete.png", $profile["id_up"], 'border:0px;', true);
$data = array ();
$data[0] = '<a href="index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&id='.$profile['id_perfil'].'">'.get_profile_name ($profile['id_perfil']).'</a>';
$data[1] = '<a href="index.php?sec=gagente&sec2=godmode/groups/group_list&id_group='.$profile['id_grupo'].'">'.get_group_name ($profile['id_grupo']).'</a>';
$data[2] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[2] .= print_input_hidden ('delete_profile', 1, true);
$data[2] .= print_input_hidden ('id_user_profile', $profile['id_up'], true);
$data[2] .= print_input_image ('del', 'images/cross.png', 1, '', true);
$data[2] .= '</form>';
array_push ($table->data, $data);
}
if (!empty ($table->data)) {
echo '<form name="profile_mod" method="post" action="index.php?sec=usuarios&sec2=godmode/users/configure_user&id='.$id.'&profile_mod=1">';
print_table ($table);
echo '</form>';
} else {
echo '<div class="nf">'.__('This user doesn\'t have any assigned profile/group').'</div>';
}
$data = array ();
$data[0] = '<form method="post">';
$data[0] .= print_select (get_profiles (), 'assign_profile', 0, '', __('None'),
0, true, false, false);
$data[1] = print_select (get_user_groups ($config['id_user'], 'UM'),
'assign_group', 0, '', __('None'), 0, true, false, false);
$data[2] = print_input_image ('add', 'images/add.png', 1, '', true);
$data[2] .= print_input_hidden ('add_profile', 1, true);
$data[2] .= '</form>';
array_push ($table->data, $data);
print_table ($table);
echo '</form>';
unset ($table);
?>
?>

View File

@ -31,11 +31,15 @@ if (! give_acl ($config['id_user'], 0, "UM")) {
if (isset ($_GET["user_del"])) { //delete user
$id_user = get_parameter_post ("delete_user");
$result = delete_user ($id_user);
print_error_message ($result, __('User successfully deleted'), __('There was a problem deleting the user'));
print_result_message ($result,
__('User successfully deleted'),
__('There was a problem deleting the user'));
} elseif (isset ($_GET["profile_del"])) { //delete profile
$id_profile = (int) get_parameter_post ("delete_profile");
$result = delete_profile ($id_profile);
print_error_message ($result, __('Profile successfully deleted'), __('There was a problem deleting the profile'));
print_result_message ($result,
__('Profile successfully deleted'),
__('There was a problem deleting the profile'));
}
echo '<h2>'.__('User management').' &gt; '.__('Users defined in Pandora').'</h2>';
@ -75,9 +79,13 @@ foreach ($info as $user_id => $user_info) {
$data[2] = print_timestamp ($user_info["last_connect"], true);
if ($user_info["is_admin"]) {
$data[3] = print_image ("images/user_suit.png", true, array ("alt" => __('Admin'), "title" => __('Administrator'))).'&nbsp;';
$data[3] = print_image ("images/user_suit.png", true,
array ("alt" => __('Admin'),
"title" => __('Administrator'))).'&nbsp;';
} else {
$data[3] = print_image ("images/user_green.png", true, array ("alt" => __('User'), "title" => __('Standard User'))).'&nbsp;';
$data[3] = print_image ("images/user_green.png", true,
array ("alt" => __('User'),
"title" => __('Standard User'))).'&nbsp;';
}
$data[3] .= '<a href="#" class="tip"><span>';
@ -96,7 +104,7 @@ foreach ($info as $user_id => $user_info) {
$data[4] = print_string_substr ($user_info["comments"], 24, true);
if ($config["admin_can_delete_user"]) {
$data[5] = print_input_image ("delete_user", "images/delete.png", $user_id, 'border:0px;', true); //Delete user button
$data[5] = print_input_image ("delete_user", "images/cross.png", $user_id, 'border:0px;', true); //Delete user button
} else {
$data[5] = ''; //Delete button not in this mode
}
@ -109,9 +117,10 @@ echo '</form>';
unset ($table);
echo '<div style="width:680px; text-align:right">';
echo '<div style="width:680px" class="action-buttons">';
if ($config["admin_can_add_user"] !== false) {
echo '<form method="post" action="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user&amp;create=1">';
echo '<form method="post" action="index.php?sec=gusuarios&amp;sec2=godmode/users/configure_user">';
print_input_hidden ('new_user', 1);
print_submit_button (__('Create user'), "crt", false, 'class="sub next"');
echo '</form>';
} else {
@ -165,7 +174,7 @@ foreach ($profiles as $profile) {
$data[8] = ($profile["db_management"] ? $img : '');
$data[9] = ($profile["alert_management"] ? $img : '');
$data[10] = ($profile["pandora_management"] ? $img : '');
$data[11] = print_input_image ("delete_profile", "images/delete.png", $profile["id_perfil"], 'border:0px;', true); //Delete profile button
$data[11] = print_input_image ("delete_profile", "images/cross.png", $profile["id_perfil"], 'border:0px;', true); //Delete profile button
array_push ($table->data, $data);
}

View File

@ -245,15 +245,6 @@ function process_user_contact ($id_user) {
//Empty function
}
/**
* Sets the user admin status (LDAP doesn't do this)
*
* @param string User id
*/
function process_user_isadmin ($id_user, $is_admin) {
return false;
}
/**
* LDAP user functions based on webcalendar's implementation
*
@ -418,7 +409,7 @@ function process_user () {
*
* @return bool false
*/
function process_user_password ( $user, $password_old, $password_new ) {
function update_user_password ($user, $password_old, $password_new) {
global $ldap_cache;
$ldap_cache["error"] = 'Changing passwords not supported';
@ -546,4 +537,4 @@ function ldap_connect_bind () {
}
}
?>
?>

View File

@ -220,53 +220,19 @@ function delete_user ($id_user) {
return true;
}
function process_user_password ( $user, $password_old, $password_new ) {
$user = process_user_login ($user, $password_old);
if ($user === false) {
global $mysql_cache;
$mysql_cache["auth_error"] = "Invalid login/password combination";
function update_user_password ($user, $password_new) {
return process_sql_update ('tusuario',
array ('password' => md5 ($password_new)),
array ('id_user' => $user));
}
function update_user ($id_user, $values) {
if (! is_array ($values))
return false;
}
return process_sql_update ("tusuario", array ("password" => md5 ($password_new)), array ("id_user" => $user));
}
function process_user_info ($id_user, $user_info) {
$values = array ();
foreach ($user_info as $key => $value) {
switch ($key) {
case "fullname":
case "firstname":
case "lastname":
case "middlename":
case "comments":
case "email":
case "phone":
$values[$key] = $value;
break;
default:
continue; //ignore
break;
}
}
return process_sql_update ("tusuario", $values, array ("id_user" => $id_user));
}
/**
* Sets the user admin status (LDAP doesn't do this)
*
* @param string User id
*/
function process_user_isadmin ($id_user, $is_admin) {
if ($is_admin == true) {
$is_admin = 1;
} else {
$is_admin = 0;
}
return process_sql_update ("tusuario", array ("is_admin" => $is_admin), array ("id_user" => $id_user));
}
//Reference the global use authorization error to last auth error.
$config["auth_error"] = &$mysql_cache["auth_error"];
?>

View File

@ -207,6 +207,11 @@ function get_profiles () {
function create_user_profile ($id_user, $id_profile = 1, $id_group = 1) {
global $config;
if (empty ($id_profile))
return false;
if (empty ($id_group))
return false;
if (isset ($config["id_user"])) {
//Usually this is set unless we call it while logging in (user known by auth scheme but not by pandora)
$assign = $config["id_user"];

View File

@ -18,8 +18,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/**
* Evaluates a result using empty() and then prints an error message or a
* success message
* Evaluates a result using empty() and then prints an error or success message
*
* @param mixed $result the results to evaluate. 0, NULL, false, '' or
* array() is bad, the rest is good
@ -32,7 +31,7 @@
*
* @return string XHTML code if return parameter is true.
*/
function print_error_message ($result, $good = '', $bad = '', $attributes = '', $return = false, $tag = 'h3') {
function print_result_message ($result, $good = '', $bad = '', $attributes = '', $return = false, $tag = 'h3') {
if ($good == '' || $good === false)
$good = __('Request successfully processed');

View File

@ -96,7 +96,8 @@ if (get_parameter ('alert_validate')) {
$result2 = validate_alert_compound ($compound_ids);
$result == $result1 || $result2;
print_error_message ($result, __('Alert(s) validated'),
print_result_message ($result,
__('Alert(s) validated'),
__('Error processing alert(s)'));
}
}

View File

@ -71,14 +71,18 @@ $validate = (bool) get_parameter ("validate");
if ($delete) {
$eventid = (array) get_parameter ("eventid", -1);
$return = delete_event ($eventid); //This function handles both single values as well arrays and cleans up before deleting
print_error_message ($return, __('Events successfully deleted'), __('There was an error deleting events'));
print_result_message ($return,
__('Successfully deleted'),
__('Could not be deleted'));
}
//Process validation (pass array or single value)
if ($validate) {
$eventid = (array) get_parameter ("eventid", -1);
$return = process_event_validate ($eventid);
print_error_message ($return, __('Events successfully validated'), __('There was an error validating events'));
print_result_message ($return,
__('Successfully validated'),
__('Could not be validated'));
}

View File

@ -55,11 +55,15 @@ if ($action == "mass") {
if ($delete_btn != -1) {
$result = delete_incidents ($id_inc);
print_error_message ($result, __('Incident successfully deleted'), __('There was a problem deleting incident'));
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}
if ($own_btn != -1) {
$result = process_incidents_chown ($id_inc, $config["id_user"]);
print_error_message ($result, __('Incident successfully owned'), __('There was a problem becoming owner of incident'));
print_result_message ($result,
__('Ssuccessfully reclaimed ownership'),
__('Could not reclame owners'));
}
} elseif ($action == "update") {
@ -90,7 +94,9 @@ if ($action == "mass") {
audit_db ($config["id_user"], $config["remote_addr"], "Incident updated","User ".$config['id_user']." updated incident #".$id_inc);
}
print_error_message ($result, __('Incident successfully updated'), __('There was a problem updating incident'));
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
} elseif ($action == "insert") {
//Create incident

View File

@ -65,7 +65,9 @@ if (isset ($_GET["id"])) {
if ($id_nota !== false) {
process_incidents_touch ($id_inc);
}
print_error_message ($id_nota, __('Note successfully added'), __('Error adding note'));
print_result_message ($id_nota,
__('Successfully added'),
__('Could not be added'));
}
// Delete note
@ -81,7 +83,9 @@ if (isset ($_GET["id"])) {
if (!empty ($result)) {
process_incidents_touch ($id_inc);
}
print_error_message ($id_nota, __('Note successfully deleted'), __('Error deleting note'));
print_result_message ($id_nota,
__('Successfully deleted'),
__('Could not be deleted'));
}
}
@ -97,7 +101,9 @@ if (isset ($_GET["id"])) {
process_incidents_touch ($id_inc);
}
print_error_message ($result, __('File successfully deleted from database'), __('Unable to delete file'));
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}
// Upload file
@ -141,7 +147,9 @@ if (isset ($_GET["id"])) {
process_sql ("DELETE FROM tattachment WHERE id_attachment = ".$id_attachment);
}
print_error_message ($result, __('File uploaded'), __('File could not be saved. Contact the Pandora Administrator for more information'));
print_result_message ($result,
__('File uploaded'),
__('File could not be uploaded'));
}
} // else Not given id
// Create incident from event... read event data

View File

@ -29,19 +29,25 @@ if (isset ($_POST["delete_message"])) {
$id = (int) get_parameter_post ("delete_message");
$result = delete_message ($id); //Delete message function will actually check the credentials
print_error_message ($result, __('Message successfully deleted'), __('There was a problem deleting the message'));
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
}
if (!empty ($dest_user) && isset ($_GET["send_message"])) {
// Create message
$return = create_message ($config["id_user"], $dest_user, $subject, $message);
print_error_message ($return, __('Message successfully sent to user: ').get_user_fullname ($dest_user), __('Error sending message to user: ').get_user_fullname ($dest_user));
print_result_message ($return,
__('Message successfully sent to user %s', get_user_fullname ($dest_user)),
__('Error sending message to user %s', get_user_fullname ($dest_user)));
}
if (!empty ($dest_group) && isset ($_GET["send_message"])) {
// Create message to groups
$return = create_message_group ($config["id_user"], $dest_group, $subject, $message);
print_error_message ($return, __('Message successfully sent'), __('Error sending message to group: ').get_group_name ($dest_group));
print_result_message ($return,
__('Message successfully sent'),
__('Error sending message to group %s ', get_group_name ($dest_group)));
}
if (isset ($_GET["mark_read"]) || isset ($_GET["mark_unread"])) {

View File

@ -48,7 +48,9 @@ if (isset ($_GET["delete"])){
if ($id_trap > 0 && give_acl ($config['id_user'], 0, "IM")) {
$sql = sprintf ("DELETE FROM ttrap WHERE id_trap = %d", $id_trap);
$result = process_sql ($sql);
print_error_message ($result, __('Event successfully deleted'), __('Error removing event'));
print_result_message ($result,
__('Successfully deleted'),
__('Could not be deleted'));
} else {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to delete SNMP event ID #".$id_trap);
@ -61,7 +63,9 @@ if (isset ($_GET["check"])) {
if ($id_trap > 1 && give_acl ($config['id_user'], 0, "IW")) {
$sql = sprintf ("UPDATE ttrap SET status = 1, id_usuario = '%s' WHERE id_trap = %d", $config["id_user"], $id_trap);
$result = process_sql ($sql);
print_error_message ($result, __('Event successfully updated'), __('Error updating event'));
print_result_message ($result,
__('Successfully updated'),
__('Could not be updated'));
} else {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to checkout SNMP Trap ID".$id_trap);

View File

@ -46,13 +46,17 @@ if (isset ($_GET["modified"]) && !$view_mode) {
//If User can update password and the new password is not the same as the old one, it's not the default and it's not empty and the new password is the same as the confirmed one
if ($config["user_can_update_password"] && $password_old !== $password_new && $password_new !== "-" && !empty ($password_new) && $password_confirm == $password_new) {
$return = process_user_password ($id, $pass);
print_error_message ($return, __('Password successfully updated'), __('Error updating passwords').": ".$config["auth_error"]);
print_result_message ($return,
__('Password successfully updated'),
__('Error updating passwords: %s', $config['auth_error']));
} elseif ($password_new !== "-") {
print_error_message (false, '', __('Passwords didn\'t match or other problem encountered while updating passwords'));
print_result_message (false, '', __('Passwords didn\'t match or other problem encountered while updating passwords'));
}
$return = process_user_info ($id, $upd_info);
print_error_message ($return, __('User info successfully updated'), __('Error updating user info'));
print_result_message ($return,
__('User info successfully updated'),
__('Error updating user info'));
$user_info = $upd_info;
}