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

* general/main_menu.php: Operation and godmode menus files includes
	now the dependant files.

	* godmode/agentes/modificar_agente.php: Removed unnecessary
	require()
	
	* godmode/alerts/alert_list.php: Avoid notice for undefined index when
	calling max(). Added option to delete the template.

	* godmode/alerts/configure_alert_template.php,
	godmode/alerts/alert_templates.php: Fixed field2_recovery and
	field3_recovery updating.

	* operation/menu.php, godmode/menu.php: Require functions_menu.php.

	* include/config_process.php: Updated build version.

	* include/functions.php: Keep time in a static variable on
	get_system_time().

	* include/functions_db.php: Now a custom operation can be passed to
	format_array_to_where_clause_sql() if the field key is numeric.

	* include/functions_reporting.php: Return float value on
	get_agentmodule_sla(). Added required files.

	* include/functions_ui.php: Show template name on format_alert_row().
	Style correction.

	* operation/agentes/export_csv.php: Style correction.
	
	* operation/events/export_csv.php: Use pandora functions to fetch
	results. Fixed auth part. Style correction.

	* operation/reporting/custom_reporting.php: Fixed enterprise include.

	* operation/reporting/reporting_xml.php: Fixed auth part.

	* index.php: process_page_head() may looked for uninitialized
	$config["refr"].

	* include/styles/pandora_width.css: Fixed style for ol.steps



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1500 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-03-03 15:21:13 +00:00
parent 0d29d5e7e3
commit 097637401f
20 changed files with 191 additions and 115 deletions

View File

@ -1,3 +1,48 @@
2009-03-03 Esteban Sanchez <estebans@artica.es>
* general/main_menu.php: Operation and godmode menus files includes
now the dependant files.
* godmode/agentes/modificar_agente.php: Removed unnecessary
require()
* godmode/alerts/alert_list.php: Avoid notice for undefined index when
calling max(). Added option to delete the template.
* godmode/alerts/configure_alert_template.php,
godmode/alerts/alert_templates.php: Fixed field2_recovery and
field3_recovery updating.
* operation/menu.php, godmode/menu.php: Require functions_menu.php.
* include/config_process.php: Updated build version.
* include/functions.php: Keep time in a static variable on
get_system_time().
* include/functions_db.php: Now a custom operation can be passed to
format_array_to_where_clause_sql() if the field key is numeric.
* include/functions_reporting.php: Return float value on
get_agentmodule_sla(). Added required files.
* include/functions_ui.php: Show template name on format_alert_row().
Style correction.
* operation/agentes/export_csv.php: Style correction.
* operation/events/export_csv.php: Use pandora functions to fetch
results. Fixed auth part. Style correction.
* operation/reporting/custom_reporting.php: Fixed enterprise include.
* operation/reporting/reporting_xml.php: Fixed auth part.
* index.php: process_page_head() may looked for uninitialized
$config["refr"].
* include/styles/pandora_width.css: Fixed style for ol.steps
2009-03-02 Evi Vanoost <vanooste@rcbi.rochester.edu> 2009-03-02 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_reporting.php: Rewrote get_agentmodule_sla with * include/functions_reporting.php: Rewrote get_agentmodule_sla with

View File

@ -21,18 +21,11 @@ if (! isset ($config["id_user"])) {
exit (); exit ();
} }
require_once ('include/functions_menu.php');
echo '<div class="tit bg">:: '.__('Operation').' ::</div>'; echo '<div class="tit bg">:: '.__('Operation').' ::</div>';
$menu = array ();
require ("operation/menu.php"); require ("operation/menu.php");
print_menu ($menu);
echo '<div class="tit bg3">:: '.__('Administration').' ::</div>'; echo '<div class="tit bg3">:: '.__('Administration').' ::</div>';
$menu = array ();
require ("godmode/menu.php"); require ("godmode/menu.php");
print_menu ($menu);
unset ($menu);
require ("links_menu.php"); require ("links_menu.php");

View File

@ -16,11 +16,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars // Load global vars
require_once ("include/config.php");
check_login (); check_login ();
// Take some parameters (GET) // Take some parameters (GET)

View File

@ -122,9 +122,9 @@ if ($create_alert) {
foreach ($actions as $id_action) { foreach ($actions as $id_action) {
$values = array (); $values = array ();
if (isset ($fires_min[$id_action])) if (isset ($fires_min[$id_action]))
$values['fires_min'] = max ($fires_min[$id_action], 0); $values['fires_min'] = @max ($fires_min[$id_action], 0);
if ($fires_max != -1) if ($fires_max != -1)
$values['fires_max'] = max ($fires_max[$id_action], 0); $values['fires_max'] = @max ($fires_max[$id_action], 0);
add_alert_agent_module_action ($id, $id_action, $values); add_alert_agent_module_action ($id, $id_action, $values);
} }
} }
@ -228,6 +228,7 @@ if (! $id_agente) {
$table->head[2] = __('Module'); $table->head[2] = __('Module');
$table->head[3] = __('Template'); $table->head[3] = __('Template');
$table->head[4] = __('Actions'); $table->head[4] = __('Actions');
$table->head[5] = '';
$table->data = array (); $table->data = array ();
foreach ($simple_alerts as $alert) { foreach ($simple_alerts as $alert) {
@ -295,6 +296,12 @@ foreach ($simple_alerts as $alert) {
$data[4] .= ' '.__('Add action'); $data[4] .= ' '.__('Add action');
$data[4] .= '</a>'; $data[4] .= '</a>';
$data[5] = '<form class="delete_alert_form" method="post" style="display: inline;">';
$data[5] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
$data[5] .= print_input_hidden ('delete_alert', 1, true);
$data[5] .= print_input_hidden ('id_alert', $alert['id'], true);
$data[5] .= '</form>';
array_push ($table->data, $data); array_push ($table->data, $data);
} }
@ -442,6 +449,7 @@ $(document).ready (function () {
return true; return true;
}); });
$("a.add_action").click (function () { $("a.add_action").click (function () {
id = this.id.split ("-").pop (); id = this.id.split ("-").pop ();
@ -452,7 +460,7 @@ $(document).ready (function () {
return false; return false;
}); });
$("form.delete_link").submit (function () { $("form.delete_link, form.delete_alert_form").submit (function () {
if (! confirm ("<?php echo __('Are you sure?')?>")) if (! confirm ("<?php echo __('Are you sure?')?>"))
return false; return false;
return true; return true;

View File

@ -110,8 +110,8 @@ if ($update_template) {
$id = (int) get_parameter ('id'); $id = (int) get_parameter ('id');
$recovery_notify = (bool) get_parameter ('recovery_notify'); $recovery_notify = (bool) get_parameter ('recovery_notify');
$field2_recovery = (bool) get_parameter ('field2_recovery'); $field2_recovery = (string) get_parameter ('field2_recovery');
$field3_recovery = (bool) get_parameter ('field3_recovery'); $field3_recovery = (string) get_parameter ('field3_recovery');
$result = update_alert_template ($id, $result = update_alert_template ($id,
array ('recovery_notify' => $recovery_notify, array ('recovery_notify' => $recovery_notify,

View File

@ -89,7 +89,7 @@ function print_alert_template_steps ($step, $id) {
} }
echo '</ol>'; echo '</ol>';
echo '<div style="clear: both;"> </div>'; echo '<div style="clear: right"> </div>';
} }
function update_template ($step) { function update_template ($step) {
@ -171,9 +171,9 @@ function update_template ($step) {
$result = update_alert_template ($id, $values); $result = update_alert_template ($id, $values);
} elseif ($step == 3) { } elseif ($step == 3) {
$recovery_notify = (bool) get_parameter ('recovery_notify'); $recovery_notify = (bool) get_parameter ('recovery_notify');
$field2_recovery = (bool) get_parameter ('field2_recovery'); $field2_recovery = (string) get_parameter ('field2_recovery');
$field3_recovery = (bool) get_parameter ('field3_recovery'); $field3_recovery = (string) get_parameter ('field3_recovery');
print_r ($_POST);
$result = update_alert_template ($id, $result = update_alert_template ($id,
array ('recovery_notify' => $recovery_notify, array ('recovery_notify' => $recovery_notify,
'field2_recovery' => $field2_recovery, 'field2_recovery' => $field2_recovery,

View File

@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
enterprise_include ('godmode/menu.php'); require_once ('include/config.php');
check_login (); check_login ();
@ -24,6 +24,10 @@ if ((! give_acl ($config['id_user'], 0, "LM")) && (! give_acl ($config['id_user'
return; return;
} }
enterprise_include ('godmode/menu.php');
require_once ('include/functions_menu.php');
$menu = array ();
$menu['class'] = 'godmode'; $menu['class'] = 'godmode';
if (give_acl ($config['id_user'], 0, "AW")) { if (give_acl ($config['id_user'], 0, "AW")) {
@ -197,4 +201,6 @@ if (is_array ($config['extensions'])) {
$menu["gextensions"]["sub"] = $sub; $menu["gextensions"]["sub"] = $sub;
} }
print_menu ($menu);
?> ?>

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//Pandora Version //Pandora Version
$build_version = 'PC090217'; $build_version = 'PC090303';
$pandora_version = 'v2.1-dev'; $pandora_version = 'v2.1-dev';
$config['start_time'] = microtime (true); $config['start_time'] = microtime (true);

View File

@ -169,7 +169,7 @@ function popup_help ($help_id, $return = false) {
* (use general/noaccess.php followed by exit instead) * (use general/noaccess.php followed by exit instead)
*/ */
function no_permission () { function no_permission () {
require("config.php"); require ("config.php");
echo "<h3 class='error'>".__('You don\'t have access')."</h3>"; echo "<h3 class='error'>".__('You don\'t have access')."</h3>";
echo "<img src='images/noaccess.png' alt='No access' width='120'><br /><br />"; echo "<img src='images/noaccess.png' alt='No access' width='120'><br /><br />";
echo "<table width=550>"; echo "<table width=550>";
@ -352,6 +352,10 @@ function human_time_comparation ($timestamp) {
*/ */
function get_system_time () { function get_system_time () {
global $config; global $config;
static $time = 0;
if ($time != 0)
return $time;
if ($config["timesource"] = "sql") { if ($config["timesource"] = "sql") {
$time = get_db_sql ("SELECT UNIX_TIMESTAMP()"); $time = get_db_sql ("SELECT UNIX_TIMESTAMP()");

View File

@ -1984,9 +1984,16 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal
$i = 1; $i = 1;
$max = count ($values); $max = count ($values);
foreach ($values as $field => $value) { foreach ($values as $field => $value) {
if (is_numeric ($field)) if (is_numeric ($field)) {
/* Avoid numeric field names */ /* User provide the exact operation to do */
$query .= $value;
if ($i < $max) {
$query .= ' '.$join.' ';
}
$i++;
continue; continue;
}
if ($field[0] != "`") { if ($field[0] != "`") {
$field = "`".$field."`"; $field = "`".$field."`";

View File

@ -17,6 +17,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require_once ($config["homedir"]."/include/functions.php");
require_once ($config["homedir"]."/include/functions_db.php");
require_once ($config["homedir"]."/include/functions_agents.php"); require_once ($config["homedir"]."/include/functions_agents.php");
/** /**
@ -29,7 +31,7 @@ require_once ($config["homedir"]."/include/functions_agents.php");
* ignore max value * ignore max value
* @param int Beginning date of the report in UNIX time (current date by default). * @param int Beginning date of the report in UNIX time (current date by default).
* *
* @return int SLA percentage of the requested module. * @return float SLA percentage of the requested module.
*/ */
function get_agentmodule_sla ($id_agentmodule, $period = 0, $min_value = 1, $max_value = false, $date = 0) { function get_agentmodule_sla ($id_agentmodule, $period = 0, $min_value = 1, $max_value = false, $date = 0) {
if (empty ($date)) { if (empty ($date)) {
@ -44,15 +46,24 @@ function get_agentmodule_sla ($id_agentmodule, $period = 0, $min_value = 1, $max
$datelimit = $date - $period; // start date $datelimit = $date - $period; // start date
/* Get the total data entries in the interval */ /* Get the total data entries in the interval */
$sql = sprintf ('SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d', $id_agentmodule, $datelimit, $date); $sql = sprintf ('SELECT COUNT(*)
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d
AND utimestamp <= %d', $id_agentmodule, $datelimit, $date);
$total = get_db_sql ($sql); $total = get_db_sql ($sql);
if (empty ($total)) { if (empty ($total)) {
//No data to calculate on so we return 100 (fail to good) //No data to calculate on so we return 100 (fail to good)
return 100; return 100.0;
} }
$sql = sprintf ('SELECT COUNT(*) FROM tagente_datos WHERE id_agente_modulo = %d AND utimestamp > %d AND utimestamp <= %d AND datos < %d', $id_agentmodule, $datelimit, $date, $min_value); $sql = sprintf ('SELECT COUNT(*)
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d
AND utimestamp <= %d
AND datos < %d', $id_agentmodule, $datelimit, $date, $min_value);
if ($max_value > $min_value) { if ($max_value > $min_value) {
$sql .= sprintf (' AND datos > %d', $max_value); $sql .= sprintf (' AND datos > %d', $max_value);
} }
@ -64,7 +75,7 @@ function get_agentmodule_sla ($id_agentmodule, $period = 0, $min_value = 1, $max
//Calculate percentage //Calculate percentage
$result = 100 - ($bad / $total) * 100; $result = 100 - ($bad / $total) * 100;
return $result; return (float) $result;
} }
/** /**

View File

@ -244,7 +244,7 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '')
} else { } else {
$id_agent = get_agentmodule_agent ($alert['id_agent_module']); $id_agent = get_agentmodule_agent ($alert['id_agent_module']);
$template = get_alert_template ($alert['id_alert_template']); $template = get_alert_template ($alert['id_alert_template']);
$description = $template['description']; $description = $template['name'];
} }
$data = array (); $data = array ();
@ -640,7 +640,9 @@ function process_page_head ($string, $bitfield) {
} }
//Pandora specific jquery should go first //Pandora specific jquery should go first
$config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery.js", "pandora" => "include/javascript/jquery.pandora.js"), $config['jquery']); $config['jquery'] = array_merge (array ("jquery" => "include/javascript/jquery.js",
"pandora" => "include/javascript/jquery.pandora.js"),
$config['jquery']);
//Then add each script as necessary //Then add each script as necessary

View File

@ -51,3 +51,6 @@ div#head {
div#foot { div#foot {
width: auto; width: auto;
} }
ol.steps {
margin-bottom: 70px;
}

View File

@ -97,18 +97,18 @@ if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) {
exit; //Always exit after sending location headers exit; //Always exit after sending location headers
} }
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
echo '<head>';
//This starts the page head. In the call back function, things from $page['head'] array will be processed into the head
ob_start ('process_page_head');
// Pure mode (without menu, header and footer). // Pure mode (without menu, header and footer).
$config["pure"] = (bool) get_parameter ("pure"); $config["pure"] = (bool) get_parameter ("pure");
// Auto Refresh page (can now be disabled anywhere in the script) // Auto Refresh page (can now be disabled anywhere in the script)
$config["refr"] = (int) get_parameter ("refr"); $config["refr"] = (int) get_parameter ("refr");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'."\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
echo '<head>';
//This starts the page head. In the call back function, things from $page['head'] array will be processed into the head
ob_start ('process_page_head');
enterprise_include ('index.php'); enterprise_include ('index.php');
//This tag is included in the buffer passed to process_page_head so technically it can be stripped //This tag is included in the buffer passed to process_page_head so technically it can be stripped

View File

@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
session_start(); session_start ();
require_once ("../../include/config.php"); require_once ("../../include/config.php");
require_once ("../../include/functions.php"); require_once ("../../include/functions.php");

View File

@ -16,80 +16,85 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
session_start(); session_start();
include ("../../include/config.php"); require_once ("../../include/config.php");
include ("../../include/functions.php"); if (!isset ($config["auth"])) {
include_once ("../../include/functions_db.php"); require_once ("../../include/auth/mysql.php");
} else {
require_once ("../../include/auth/".$config["auth"]["scheme"].".php");
}
require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php");
require_once ("../../include/functions_events.php");
session_write_close(); session_write_close ();
$config["id_user"] = $_SESSION["id_usuario"]; $config["id_user"] = $_SESSION["id_usuario"];
if ( (give_acl($config["id_user"], 0, "AR")==0) AND (give_acl($config["id_user"], 0, "AW")==0) ){ if (! give_acl ($config["id_user"], 0, "AR") && ! give_acl ($config["id_user"], 0, "AW")) {
require ("../../general/noaccess.php");
exit; exit;
} }
$offset = (int) get_parameter ("offset");
$ev_group = (int) get_parameter ("ev_group"); // group
$search = (int) get_parameter ("search"); // free search
$event_type = (string) get_parameter ("event_type", "all"); // 0 all
$severity = (int) get_parameter ("severity", -1); // -1 all
$status = (int) get_parameter ("status", -1); // -1 all, 0 only red, 1 only green
$id_agent = (int) get_parameter ("id_agent", -1);
$offset = get_parameter ( "offset",0); $filter = array ();
$ev_group = get_parameter ("ev_group", 0); // group
$search = get_parameter ("search", ""); // free search
$event_type = get_parameter ("event_type", "all"); // 0 all
$severity = get_parameter ("severity", -1); // -1 all
$status = get_parameter ("status", -1); // -1 all, 0 only red, 1 only green
$id_agent = get_parameter ("id_agent", -1);
$sql_post = "";
if ($ev_group > 1) if ($ev_group > 1)
$sql_post .= " AND id_grupo = $ev_group"; $filter['id_grupo'] = $ev_group;
if ($status == 1) if ($status == 1)
$sql_post .= " AND estado = 1"; $filter['estado'] = 1;
if ($status == 0) if ($status == 0)
$sql_post .= " AND estado = 0"; $filter['estado'] = 0;
if ($search != "") if ($search != "")
$sql_post .= " AND evento LIKE '%$search%'"; $filter[] = 'evento LIKE "%'.$search.'%"';
if (($event_type != "all") AND ($event_type != 0)) if (($event_type != "all") AND ($event_type != 0))
$sql_post .= " AND event_type = '$event_type'"; $filter['event_type'] = $event_type;
if ($severity != -1) if ($severity != -1)
$sql_post .= " AND criticity >= $severity"; $filter[] = 'criticity >= '.$severity;
if ($id_agent != -1) if ($id_agent != -1)
$sql_post .= " AND id_agente = $id_agent"; $filter['id_agente'] = $id_agent;
$sql2 = "SELECT * FROM tevento WHERE 1=1 "; $filter['order'] = 'timestamp DESC';
$sql2 .= $sql_post . " ORDER BY timestamp DESC"; $now = date ("Y-m-d");
$now = date("Y-m-d");
// Show contentype header // Show contentype header
Header("Content-type: text/txt"); Header ("Content-type: text/txt");
header('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.txt"'); header ('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.txt"');
echo "timestamp, agent, group, event, status, user, event_type, severity"; echo "timestamp, agent, group, event, status, user, event_type, severity";
echo chr(13); echo chr (13);
$result=mysql_query($sql2); $fields = array ('id_grupo', 'id_agente', 'evento', 'estado', 'id_usuario',
while ($row=mysql_fetch_array($result)){ 'event_type', 'criticity', 'timestamp');
$id_grupo = $row["id_grupo"]; $events = get_events ($filter, $fields);
if (give_acl($config["id_user"], $id_grupo, "AR") == 1){ // Only incident read access to view data ! if ($events === false)
echo $row["timestamp"]; $events = array ();
echo ", "; foreach ($events as $event) {
echo get_db_sql("SELECT nombre FROM tagente WHERE id_agente = '".$row["id_agente"]."'"); if (! give_acl ($config["id_user"], $event["id_grupo"], "AR"))
echo ", "; continue;
echo get_db_sql("SELECT nombre FROM tgrupo WHERE id_grupo = '".$row["id_grupo"]."'");
echo ", "; echo $event["timestamp"];
echo $row["evento"]; echo ",";
echo ", "; echo get_db_value ('nombre', 'tagente', 'id_agente', $event["id_agente"]);
echo $row["estado"]; echo ",";
echo ", "; echo get_db_value ('nombre', 'tgrupo', 'id_grupo', $event["id_grupo"]);
echo $row["id_usuario"]; echo ",";
echo ", "; echo $event["evento"];
echo $row["event_type"]; echo ",";
echo ", "; echo $event["estado"];
echo $row["criticity"]; echo ",";
echo chr(13); echo $event["id_usuario"];
} echo ",";
echo $event["event_type"];
echo ",";
echo $event["criticity"];
echo chr (13);
} }
?> ?>

View File

@ -20,8 +20,11 @@ if (! isset ($config['id_user'])) {
return; return;
} }
require_once ('include/functions_menu.php');
enterprise_include ('operation/menu.php'); enterprise_include ('operation/menu.php');
$menu = array ();
$menu['class'] = 'operation'; $menu['class'] = 'operation';
// Agent read, Server read // Agent read, Server read
@ -197,4 +200,6 @@ if (give_acl ($config['id_user'], 0, "AR")) {
$menu["extensions"]["sub"] = $sub; $menu["extensions"]["sub"] = $sub;
} }
} }
print_menu ($menu);
?> ?>

View File

@ -16,17 +16,11 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Login check // Login check
require ("include/config.php");
check_login (); check_login ();
// Load enterprise extensions // Load enterprise extensions
if (file_exists( $config["homedir"] . "/enterprise/operation/reporting/custom_reporting.php")) { enterprise_include ('operation/reporting/custom_reporting.php');
include $config["homedir"] . "/enterprise/operation/reporting/custom_reporting.php";
}
echo "<h2>".__('Reporting')." &gt; "; echo "<h2>".__('Reporting')." &gt; ";
echo __('Custom reporting')."</h2>"; echo __('Custom reporting')."</h2>";

View File

@ -512,7 +512,6 @@ foreach ($contents as $content) {
break; break;
} }
print_table ($table); print_table ($table);
flush (); flush ();
} }

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Login check // Login check
if (isset ($_GET["direct"])) { if (isset ($_GET["direct"])) {
/* /*
This is in case somebody wants to access the XML directly without This is in case somebody wants to access the XML directly without
having the possibility to login and handle sessions having the possibility to login and handle sessions
@ -27,10 +27,9 @@ if (isset ($_GET["direct"])) {
Although it's not recommended, you can put your login and password Although it's not recommended, you can put your login and password
in a GET request (append &nick=<yourlogin>&password=<password>). in a GET request (append &nick=<yourlogin>&password=<password>).
You SHOULD put it in a POST but some programs You SHOULD put it in a POST but some programs
might not be able to handle it without extensive re-programming might not be able to handle it without extensive re-programming.
(M$ ShitPoint). Either way, you should have a read-only user for getting reports Either way, you should have a read-only user for getting reports
XMLHttpRequest can do it (example): XMLHttpRequest can do it (example):
@ -56,9 +55,9 @@ if (isset ($_GET["direct"])) {
require_once ("../../include/functions_reporting.php"); require_once ("../../include/functions_reporting.php");
if (!isset ($config["auth"])) { if (!isset ($config["auth"])) {
require_once ("include/auth/mysql.php"); require_once ("../../include/auth/mysql.php");
} else { } else {
require_once ("include/auth/".$config["auth"]["scheme"].".php"); require_once ("../../include/auth/".$config["auth"]["scheme"].".php");
} }
$nick = get_parameter ("nick"); $nick = get_parameter ("nick");
@ -77,12 +76,12 @@ if (isset ($_GET["direct"])) {
} else { } else {
// User not known // User not known
$login_failed = true; $login_failed = true;
require_once ('general/login_page.php'); require_once ($config['homedir'].'/general/login_page.php');
audit_db ($nick, $REMOTE_ADDR, "Logon Failed", "Invalid login: ".$nick); audit_db ($nick, $REMOTE_ADDR, "Logon Failed", "Invalid login: ".$nick);
exit; exit;
} }
} else { } else {
require_once ("include/config.php"); @require_once ("include/config.php");
require_once ("include/functions_reporting.php"); require_once ("include/functions_reporting.php");
if (!isset ($config["auth"])) { if (!isset ($config["auth"])) {
@ -92,7 +91,7 @@ if (isset ($_GET["direct"])) {
} }
} }
check_login(); check_login ();
$id_report = (int) get_parameter ('id'); $id_report = (int) get_parameter ('id');
@ -100,7 +99,7 @@ if (! $id_report) {
audit_db ($config['id_user'], $REMOTE_ADDR, "HACK Attempt", audit_db ($config['id_user'], $REMOTE_ADDR, "HACK Attempt",
"Trying to access graph viewer without valid ID"); "Trying to access graph viewer without valid ID");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; return;
} }
$report = get_db_row ('treport', 'id_report', $id_report); $report = get_db_row ('treport', 'id_report', $id_report);
@ -108,7 +107,7 @@ $report = get_db_row ('treport', 'id_report', $id_report);
if (! give_acl ($config['id_user'], $report['id_group'], "AR")) { if (! give_acl ($config['id_user'], $report['id_group'], "AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation","Trying to access graph reader"); audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation","Trying to access graph reader");
include ("general/noaccess.php"); include ("general/noaccess.php");
exit; return;
} }
/* Check if the user can see the graph */ /* Check if the user can see the graph */
@ -188,7 +187,7 @@ foreach ($contents as $content) {
case 'SLA': case 'SLA':
$data["title"] = __('S.L.A.'); $data["title"] = __('S.L.A.');
$slas = get_db_all_rows_field_filter ('treport_content_sla_combined','id_report_content', $content['id_rc']); $slas = get_db_all_rows_field_filter ('treport_content_sla_combined', 'id_report_content', $content['id_rc']);
if ($slas === false) { if ($slas === false) {
$data["objdata"]["error"] = __('There are no SLAs defined'); $data["objdata"]["error"] = __('There are no SLAs defined');
$slas = array (); $slas = array ();
@ -283,7 +282,6 @@ foreach ($contents as $content) {
array_push ($xml["reports"], $data); array_push ($xml["reports"], $data);
} }
function xml_array ($array) { function xml_array ($array) {
foreach ($array as $name => $value) { foreach ($array as $name => $value) {
if (is_int ($name)) { if (is_int ($name)) {