2013-02-28 Sergio Martin <sergio.martin@artica.es>

* include/functions_io.php
	include/functions_ui.php
	include/functions_reporting.php
	general/logon_ok.php: Improve the main screen putting the 
	last activity in left column, adding icons and improving titles

	* godmode/massive/massive_add_alerts.php
	godmode/massive/massive_copy_modules.php
	godmode/massive/massive_delete_agents.php
	godmode/massive/massive_enable_disable_alerts.php
	godmode/massive/massive_delete_profiles.php
	godmode/massive/massive_edit_agents.php
	godmode/massive/massive_delete_action_alerts.php
	godmode/massive/massive_add_profiles.php
	godmode/massive/massive_delete_alerts.php
	godmode/massive/massive_edit_modules.php
	godmode/massive/massive_standby_alerts.php
	godmode/massive/massive_add_action_alerts.php: Fix typo in
	logger actions



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7743 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-02-28 11:43:10 +00:00
parent fefa6f0707
commit 7a4ab68386
17 changed files with 232 additions and 149 deletions

View File

@ -1,3 +1,25 @@
2013-02-28 Sergio Martin <sergio.martin@artica.es>
* include/functions_io.php
include/functions_ui.php
include/functions_reporting.php
general/logon_ok.php: Improve the main screen putting the
last activity in left column, adding icons and improving titles
* godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php: Fix typo in
logger actions
2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: into the function

View File

@ -37,40 +37,127 @@ if(tags_has_user_acl_tags()) {
// Site news !
// ---------------------------------------------------------------------------
echo '<div>'; // Container top
echo '<div style="width:50%; float:left; padding-right: 30px;" id="leftcolumn">';
//////////////////NEWS BOARD/////////////////////////////
echo '<div id="news_board">';
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT subject,timestamp,text,author FROM tnews ORDER by timestamp DESC LIMIT 3";
break;
case "oracle":
$sql = "SELECT subject,timestamp,text,author FROM tnews where rownum <= 3 ORDER by timestamp DESC";
break;
}
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$sql = "SELECT subject,timestamp,text,author FROM tnews ORDER by timestamp DESC LIMIT 3";
break;
case "oracle":
$sql = "SELECT subject,timestamp,text,author FROM tnews where rownum <= 3 ORDER by timestamp DESC";
break;
}
$news = db_get_all_rows_sql ($sql);
if ($news !== false) {
echo '<table cellpadding="4" cellspacing="4" class="databox">';
if ($config["prominent_time"] == "timestamp") {
$comparation_suffix = "";
$news = db_get_all_rows_sql ($sql);
if ($news !== false) {
echo '<table cellpadding="4" cellspacing="4" class="databox">';
echo '<tr><th><span class="med_data">' . __('News board') . '</span></th></tr>';
if ($config["prominent_time"] == "timestamp") {
$comparation_suffix = "";
}
else {
$comparation_suffix = __('ago');
}
foreach ($news as $article) {
echo '<tr><th><b>'.$article["subject"].'</b></th></tr>';
echo '<tr><td>'.__('by').' <b>'.$article["author"].'</b> <i>' . ui_print_timestamp ($article["timestamp"], true).'</i> ' . $comparation_suffix . '</td></tr>';
echo '<tr><td class="datos">';
echo nl2br ($article["text"]);
echo '</td></tr>';
}
echo '</table>';
}
else {
$comparation_suffix = __('ago');
echo '<div>'.__('No news articles at this moment').'</div>';
}
foreach ($news as $article) {
echo '<tr><th><b>'.$article["subject"].'</b></th></tr>';
echo '<tr><td>'.__('by').' <b>'.$article["author"].'</b> <i>' . ui_print_timestamp ($article["timestamp"], true).'</i> ' . $comparation_suffix . '</td></tr>';
echo '<tr><td class="datos">';
echo nl2br ($article["text"]);
echo '</td></tr>';
echo '</div>'; // News board
//////////////////END OF NEWS BOARD/////////////////////////////
echo '<br><br>';
//////////////////LAST ACTIVITY/////////////////////////////
// Show last activity from this user
echo '<div id="activity">';
$table->width = '100%'; //Don't specify px
$table->data = array ();
$table->size = array ();
$table->style[2] = 'text-align:center;';
$table->size[1] = '150px';
$table->size[2] = '130px';
$table->size[4] = '200px';
$table->head = array ();
$table->head[0] = __('User');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
$table->title = '<span class="med_data">' . __('This is your last activity in Pandora FMS console') . '</span>';
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion,utimestamp
FROM tsesion
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - " . SECONDS_1WEEK . ")
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
break;
case "postgresql":
$sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion, utimestamp
FROM tsesion
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_1WEEK . ")
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]);
break;
case "oracle":
$sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion, utimestamp
FROM tsesion
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_1WEEK . ")
AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]);
break;
}
echo '</table>';
}
else {
echo '<div>'.__('No news articles at this moment').'</div>';
}
$sessions = db_get_all_rows_sql ($sql);
if ($sessions === false)
$sessions = array ();
foreach ($sessions as $session) {
$data = array ();
switch ($config["dbtype"]) {
case "mysql":
case "oracle":
$session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['ip_origen'];
break;
case "postgresql":
$session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['ip_origen'];
break;
}
$data[0] = '<strong>' . $session_id_usuario . '</strong>';
$data[1] = ui_print_session_action_icon ($session['accion'], true);
$data[1] .= $session['accion'];
$data[2] = human_time_comparation($session['utimestamp']) . ui_print_help_tip($session['fecha'], true);
$data[3] = $session_ip_origen;
$data[4] = io_safe_output ($session['descripcion']);
array_push ($table->data, $data);
}
echo "<div style='width:100%; overflow-x:auto;'>";
html_print_table ($table);
unset($table);
echo "</div>";
echo "</div>"; // activity
//////////////////END OF LAST ACTIVIYY/////////////////////////////
echo '</div>';
@ -91,7 +178,7 @@ $table->head = array ();
$table->data = array ();
$table->style[0] = 'text-align:center;';
$table->width = "100%";
$table->head[0] = __('Pandora FMS Overview');
$table->head[0] = '<span class="med_data">' . __('Pandora FMS Overview') . '</span>';
$table->head_colspan[0] = 4;
// Indicators
@ -130,76 +217,4 @@ unset($table);
echo "</div>";
echo "<div style='clear:both'></div>";
echo '</div>'; // Container top
echo '<div id="activity" style="width:87%;">';
// Show last activity from this user
echo "<h4>" . __('This is your last activity in Pandora FMS console') . "</h4>";
$table->width = '98%'; //Don't specify px
$table->data = array ();
$table->size = array ();
$table->size[2] = '130px';
$table->size[4] = '200px';
$table->head = array ();
$table->head[0] = __('User');
$table->head[1] = __('Action');
$table->head[2] = __('Date');
$table->head[3] = __('Source IP');
$table->head[4] = __('Comments');
switch ($config["dbtype"]) {
case "mysql":
$sql = sprintf ("SELECT id_usuario,accion,fecha,ip_origen,descripcion
FROM tsesion
WHERE (`utimestamp` > UNIX_TIMESTAMP(NOW()) - " . SECONDS_1WEEK . ")
AND `id_usuario` = '%s' ORDER BY `utimestamp` DESC LIMIT 10", $config["id_user"]);
break;
case "postgresql":
$sql = sprintf ("SELECT \"id_usuario\", accion, fecha, \"ip_origen\", descripcion
FROM tsesion
WHERE (\"utimestamp\" > ceil(date_part('epoch', CURRENT_TIMESTAMP)) - " . SECONDS_1WEEK . ")
AND \"id_usuario\" = '%s' ORDER BY \"utimestamp\" DESC LIMIT 10", $config["id_user"]);
break;
case "oracle":
$sql = sprintf ("SELECT id_usuario, accion, fecha, ip_origen, descripcion
FROM tsesion
WHERE ((utimestamp > ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (" . SECONDS_1DAY . ")) - " . SECONDS_1WEEK . ")
AND id_usuario = '%s') AND rownum <= 10 ORDER BY utimestamp DESC", $config["id_user"]);
break;
}
$sessions = db_get_all_rows_sql ($sql);
if ($sessions === false)
$sessions = array ();
foreach ($sessions as $session) {
$data = array ();
switch ($config["dbtype"]) {
case "mysql":
case "oracle":
$session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['ip_origen'];
break;
case "postgresql":
$session_id_usuario = $session['id_usuario'];
$session_ip_origen = $session['ip_origen'];
break;
}
$data[0] = '<strong>' . $session_id_usuario . '</strong>';
$data[1] = $session['accion'];
$data[2] = $session['fecha'];
$data[3] = $session_ip_origen;
$data[4] = io_safe_output ($session['descripcion']);
array_push ($table->data, $data);
}
echo "<div style='width:100%; overflow-x:auto;'>";
html_print_table ($table);
echo "</div>";
echo "</div>"; // activity
?>

View File

@ -94,7 +94,7 @@ if ($add) {
}
}
db_pandora_audit("Masive management", "Add alert action " . json_encode($id_agents), false, false, 'Agents: ' .
db_pandora_audit("Massive management", "Add alert action " . json_encode($id_agents), false, false, 'Agents: ' .
json_encode($id_agents) . ' Alerts : ' . json_encode($agent_alerts) .
' Fires Min: ' . $fires_min . ' Fires Max: ' . $fires_max . ' Actions: ' . implode(',',$actions));
@ -257,4 +257,4 @@ $(document).ready (function () {
$('#id_group').trigger('change');
});
/* ]]> */
</script>
</script>

View File

@ -78,10 +78,10 @@ function process_manage_add ($id_alert_template, $id_agents, $module_names) {
}
if ($contsuccess > 0) {
db_pandora_audit("Masive management", "Add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
db_pandora_audit("Massive management", "Add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
}
else {
db_pandora_audit("Masive management", "Fail try to add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
db_pandora_audit("Massive management", "Fail try to add alert", false, false, "Alert template: " . $id_alert_template . " Modules: " . json_encode($modules_id));
}
ui_print_result_message ($contsuccess > 0,

View File

@ -60,11 +60,11 @@ if ($create_profiles) {
}
if ($n_added > 0) {
db_pandora_audit("Masive management", "Add profiles", false, false,
db_pandora_audit("Massive management", "Add profiles", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . json_encode($groups_id) . 'Users: ' . json_encode($users_id));
}
else {
db_pandora_audit("Masive management", "Fail to try add profiles", false, false,
db_pandora_audit("Massive management", "Fail to try add profiles", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . json_encode($groups_id) . 'Users: ' . json_encode($users_id));
}

View File

@ -42,11 +42,11 @@ if ($do_operation) {
$result = agents_process_manage_config ($source_id_agent, $destiny_id_agents);
if ($result) {
db_pandora_audit("Masive management", "Copy modules", false, false,
db_pandora_audit("Massive management", "Copy modules", false, false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
}
else {
db_pandora_audit("Masive management", "Fail to try copy modules", false, false,
db_pandora_audit("Massive management", "Fail to try copy modules", false, false,
'Source agent: ' . json_encode($source_id_agent) . ' Destinity agent: ' . json_encode($destiny_id_agents));
}
}
@ -361,4 +361,4 @@ $(document).ready (function () {
});
});
/* ]]> */
</script>
</script>

View File

@ -91,12 +91,12 @@ if ($delete) {
}
if ($results) {
db_pandora_audit("Masive management", "Delete alert action", false, false,
db_pandora_audit("Massive management", "Delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Actions: ' . implode(',',$actions));
}
else {
db_pandora_audit("Masive management", "Fail try to delete alert action", false, false,
db_pandora_audit("Massive management", "Fail try to delete alert action", false, false,
'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) .
' Actions: ' . implode(',',$actions));
}

View File

@ -80,11 +80,11 @@ if ($delete) {
$result = process_manage_delete ($id_agents);
if ($result) {
db_pandora_audit("Masive management", "Delete agent ", false, false,
db_pandora_audit("Massive management", "Delete agent ", false, false,
'Agent: ' . json_encode($id_agents));
}
else {
db_pandora_audit("Masive management", "Fail try to delete agent", false, false,
db_pandora_audit("Massive management", "Fail try to delete agent", false, false,
'Agent: ' . json_encode($id_agents));
}
}

View File

@ -140,11 +140,11 @@ if ($delete) {
$result = process_manage_delete ($id_alert_template, $id_agents, $module_names);
if ($result) {
db_pandora_audit("Masive management", "Delete alert ", false, false,
db_pandora_audit("Massive management", "Delete alert ", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
}
else {
db_pandora_audit("Masive management", "Fail try to delete alert", false, false,
db_pandora_audit("Massive management", "Fail try to delete alert", false, false,
'Agent: ' . json_encode($id_agents) . ' Template: ' . $id_alert_template . ' Module: ' . $module_names);
}
}

View File

@ -75,11 +75,11 @@ if ($delete_profiles) {
}
if ($result) {
db_pandora_audit("Masive management", "Delete profile ", false, false,
db_pandora_audit("Massive management", "Delete profile ", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
}
else {
db_pandora_audit("Masive management", "Fail try to delete profile", false, false,
db_pandora_audit("Massive management", "Fail try to delete profile", false, false,
'Profiles: ' . json_encode($profiles_id) . ' Groups: ' . $groups_id . ' Users: ' . $users_id);
}
@ -177,4 +177,4 @@ $(document).ready (function () {
});
});
/* ]]> */
</script>
</script>

View File

@ -111,10 +111,10 @@ if ($update_agents) {
if ($n_deleted > 0) {
db_pandora_audit("Masive management", "Delete conf file " . $id_agent);
db_pandora_audit("Massive management", "Delete conf file " . $id_agent);
}
else {
db_pandora_audit("Masive management", "Try to delete conf file " . $id_agent);
db_pandora_audit("Massive management", "Try to delete conf file " . $id_agent);
}
@ -162,11 +162,11 @@ if ($update_agents) {
if ($result !== false) {
db_pandora_audit("Masive management", "Update agent " . $id_agent, false, false, json_encode($fields));
db_pandora_audit("Massive management", "Update agent " . $id_agent, false, false, json_encode($fields));
}
else {
if (isset ($id_agent)) {
db_pandora_audit("Masive management", "Try to update agent " . $id_agent, false, false, json_encode($fields));
db_pandora_audit("Massive management", "Try to update agent " . $id_agent, false, false, json_encode($fields));
}
}

View File

@ -133,10 +133,10 @@ if ($update) {
$info = 'Modules: ' . json_encode($modules_) . ' Agents: ' . json_encode($agents_);
if ($success > 0) {
db_pandora_audit("Masive management", "Edit module", false, false, $info);
db_pandora_audit("Massive management", "Edit module", false, false, $info);
}
else {
db_pandora_audit("Masive management", "Fail try to edit module", false, false, $info);
db_pandora_audit("Massive management", "Fail try to edit module", false, false, $info);
}
}
@ -749,4 +749,4 @@ function process_manage_edit ($module_name, $agents_select = null) {
return true;
}
?>
?>

View File

@ -79,10 +79,10 @@ switch ($action) {
$info = 'Alert: ' . json_encode($id_disabled_alerts);
if ($result) {
db_pandora_audit("Masive management", "Enable alert", false, false, $info);
db_pandora_audit("Massive management", "Enable alert", false, false, $info);
}
else {
db_pandora_audit("Masive management", "Fail try to enable alert", false, false, $info);
db_pandora_audit("Massive management", "Fail try to enable alert", false, false, $info);
}
break;
case 'disable_alerts':
@ -97,10 +97,10 @@ switch ($action) {
$info = 'Alert: ' . json_encode($id_enabled_alerts);
if ($result) {
db_pandora_audit("Masive management", "Disable alert", false, false, $info);
db_pandora_audit("Massive management", "Disable alert", false, false, $info);
}
else {
db_pandora_audit("Masive management", "Fail try to Disable alert", false, false, $info);
db_pandora_audit("Massive management", "Fail try to Disable alert", false, false, $info);
}
break;
default:
@ -311,4 +311,4 @@ $(document).ready (function () {
}
});
/* ]]> */
</script>
</script>

View File

@ -79,10 +79,10 @@ switch($action) {
$info = 'Alert: ' . json_encode($id_standby_alerts);
if ($result) {
db_pandora_audit("Masive management", "Set off standby alerts", false, false, $info);
db_pandora_audit("Massive management", "Set off standby alerts", false, false, $info);
}
else {
db_pandora_audit("Masive management", "Fail try to set off standby alerts", false, false, $info);
db_pandora_audit("Massive management", "Fail try to set off standby alerts", false, false, $info);
}
break;
case 'set_standby_alerts':
@ -97,10 +97,10 @@ switch($action) {
$info = 'Alert: ' . json_encode($id_not_standby_alerts);
if ($result) {
db_pandora_audit("Masive management", "Set on standby alerts", false, false, $info);
db_pandora_audit("Massive management", "Set on standby alerts", false, false, $info);
}
else {
db_pandora_audit("Masive management", "Fail try to set on standby alerts", false, false, $info);
db_pandora_audit("Massive management", "Fail try to set on standby alerts", false, false, $info);
}
break;
default:
@ -312,4 +312,4 @@ $(document).ready (function () {
}
});
/* ]]> */
</script>
</script>

View File

@ -382,19 +382,17 @@ function __ ($string /*, variable arguments */) {
return $tranlateString;
}
}
elseif (isset($config['enterprise_installed'])) {
if ($config['enterprise_installed'] &&
isset($config['translate_string_extension_installed']) &&
$config['translate_string_extension_installed'] == 1 &&
array_key_exists('translate_string.php', $extensions)) {
enterprise_include_once('extensions/translate_string/functions.php');
$tranlateString = get_defined_translation($string);
if ($tranlateString !== false) {
return $tranlateString;
}
elseif ($config['enterprise_installed'] &&
isset($config['translate_string_extension_installed']) &&
$config['translate_string_extension_installed'] == 1 &&
array_key_exists('translate_string.php', $extensions)) {
enterprise_include_once('extensions/translate_string/functions.php');
$tranlateString = get_defined_translation($string);
if ($tranlateString !== false) {
return $tranlateString;
}
}

View File

@ -1059,7 +1059,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
$table_sum->cellstyle[count($table_sum->data)][0] = 'text-align: center;';
$table_sum->cellstyle[count($table_sum->data)][2] = 'text-align: center;';
$tdata[0] = '<span class="med_data" style="color: #666">' . __('Module status') . '</span>';
$tdata[2] = '<span class="med_data" style="color: #666">' . __('Alert status') . '</span>';
$tdata[2] = '<span class="med_data" style="color: #666">' . __('Alert level') . '</span>';
$table_sum->rowclass[] = '';
$table_sum->data[] = $tdata;

View File

@ -1525,6 +1525,54 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
return $output;
}
/**
* Prints only a tip button which shows a text when the user puts the mouse over it.
*
* @param string Complete text to show in the tip
* @param bool whether to return an output string or echo now
* @param img displayed image
*
* @return string HTML code if return parameter is true.
*/
function ui_print_session_action_icon ($action, $return = false) {
$key_icon = array(
'acl' => 'images/delete.png',
'agent' => 'images/bricks.png',
'module' => 'images/brick.png',
'alert' => 'images/bell.png',
'incident' => 'images/book_edit.png',
'logon' => 'images/house.png',
'logoff' => 'images/logout.png',
'massive' => 'images/sitemap_color.png',
'hack' => 'images/info.png',
'event' => 'images/lightning_go.png',
'policy' => 'images/policies.png',
'report' => 'images/reporting.png',
'file collection' => 'images/file.png',
'user' => 'images/user.png',
'password' => 'images/lock.png',
'session' => 'images/heart.png',
'snmp' => 'images/snmp.png',
'command' => 'images/bell.png',
'category' => 'images/god6.png',
'dashboard' => 'images/application_double.png',
'api' => 'images/page_white_text.png',
'db' => 'images/database.png'
);
$output = '';
foreach($key_icon as $key => $icon) {
if (stristr($action, $key) !== false) {
$output = html_print_image($icon, true, array('title' => $action)) . ' ';
break;
}
}
if ($return)
return $output;
echo $output;
}
/**
* Prints only a tip button which shows a text when the user puts the mouse over it.
*