2007-06-21 Sancho Lerena <slerena@artica.es>

* include/languages/language_en.php: More strings.

        * include/functions.php: entrada_limpia() should work fine in UTF8.

        * operation/incidents/incident.php: Fixed many ugly things.

        * operation/incidents/incident_detail.php: Fixed many ugly things.

        * operation/incidents/incident_note.php: Fixed many ugly things.

        * operation/events/event_statistics.php: Fixed graphs.

        * operation/events/events.php: Fixed some legend position and header.

        * operation/agentes/tactical.php: Fixed divzero error.

        * operation/menu.php: SNMP Alert not shown to normal users anymore.

        * reporting/Image/Canvas/GD.php: Added errorlevel setting to 0
        (disable warnings for graphs).

        * reporting/fgraph.php: MANY graphs migrated from jpgraph to peargraph.

        * general/header.php: More width for header information.

        * godmode/admin_access_logs.php: Added graph to header.

        * godmode/reporting/map_builder.php: Removed debug stuff



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@531 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-06-21 18:58:35 +00:00
parent bd6c70165e
commit 91b03f2aed
15 changed files with 477 additions and 553 deletions

View File

@ -1,5 +1,34 @@
2007-06-21 Sancho Lerena <slerena@artica.es>
* include/languages/language_en.php: More strings.
* include/functions.php: entrada_limpia() should work fine in UTF8.
* operation/incidents/incident.php: Fixed many ugly things.
* operation/incidents/incident_detail.php: Fixed many ugly things.
* operation/incidents/incident_note.php: Fixed many ugly things.
* operation/events/event_statistics.php: Fixed graphs.
* operation/events/events.php: Fixed some legend position and header.
* operation/agentes/tactical.php: Fixed divzero error.
* operation/menu.php: SNMP Alert not shown to normal users anymore.
* reporting/Image/Canvas/GD.php: Added errorlevel setting to 0
(disable warnings for graphs).
* reporting/fgraph.php: MANY graphs migrated from jpgraph to peargraph.
* general/header.php: More width for header information.
* godmode/admin_access_logs.php: Added graph to header.
* godmode/reporting/map_builder.php: Removed debug stuff
* images/op*.gif, god*.gif: deleted. Also deleted several other
GIF files.

View File

@ -29,7 +29,7 @@ echo '
';
echo "<div id='head_m'>";
echo "<table border='0'>
echo "<table width=620 border='0'>
<tr>";
if (isset ($_SESSION["id_usuario"])){
echo "<td width=40%>";

View File

@ -39,6 +39,9 @@
else
$offset=0;
echo "<table width=100%>";
echo "<tr><td>";
// Manage GET/POST parameter for subselect on action type. POST parameter are proccessed before GET parameter (if passed)
if (isset($_GET["tipo_log"])){
$tipo_log = $_GET["tipo_log"];
@ -83,6 +86,10 @@
echo "<td valign='middle'><noscript><input name='uptbutton' type='submit' class='sub' value='".$lang_label["show"]."'></noscript>";
echo "</table></form>";
echo "</td><td align='right'>";
echo "<img src='reporting/fgraph.php?tipo=user_activity&width=300&height=140'>";
echo "</table>";
$sql2="SELECT COUNT(*) FROM tsesion ".$tipo_log_select." ORDER BY fecha DESC";
$result2=mysql_query($sql2);
$row2=mysql_fetch_array($result2);

View File

@ -110,7 +110,6 @@ if (isset($_GET["update_module"])){
$result = "<h3 class=suc>".$lang_label["modify_ok"]."</h3>";
else {
$result = "<h3 class=error>".$lang_label["modify_no"]."</h3>";
echo $sql;
echo "<br><br>";
}
echo $result;
@ -158,7 +157,6 @@ if (isset($_POST["createmode"])){
$map_background = entrada_limpia($_POST["map_background"]);
$map_width = entrada_limpia($_POST["map_width"]);
$map_height = entrada_limpia($_POST["map_height"]);
// INSERT REPORT DATA
if ($createmode == 1){

View File

@ -84,16 +84,9 @@ function output_clean_strict ($string){
// ---------------------------------------------------------------
function entrada_limpia ($texto){
// OJO: MagicQuotes en la configuracion de php.ini deberia estar activado y esta funcion solo deberiamos
// llamarla al entrar datos para escribir datos en la base MYSQL no al reves.
// $str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
// $filtro0 = utf8_decode($texto);
$filtro1 = htmlentities($texto, ENT_QUOTES); // Primero evitamos el problema de las dobles comillas, comillas sueltas, etc.
$filtro2 = $filtro1;
// Sustituimos los caracteres siguientes ( ) : &
// $filtro2 = strtr($filtro1, array('&' => '&#38',':' => '58', '(' => '&#40;', ')' => '&#41;'));
return $filtro2;
$filtro0 = utf8_decode($texto);
$filtro1 = htmlentities($filtro0, ENT_QUOTES);
return $filtro1;
}
// ---------------------------------------------------------------

View File

@ -873,6 +873,9 @@ $lang_label["time_to"]="Time to";
$lang_label["time"]="Time";
$lang_label["module_graph"] = "Module graph";
$lang_label["map_item_add"] = "Add map item";
$lang_label["graph_event_total"] = "Event graph";
$lang_label["graph_event_group"] = "Event graph by group";
$lang_label["graph_event_user"] = "Event graph by user";
global $lang_label;
global $help_label;
?>

View File

@ -218,9 +218,19 @@
// Odometer Graph
// ~~~~~~~~~~~~~~~
$monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown)/ $monitor_checks) * 100,1);
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
$global_health = format_numeric( ((($monitor_ok -$monitor_alert - $monitor_unknown )+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1);
if ($monitor_checks > 0){
$monitor_health = format_numeric ((($monitor_ok - $monitor_alert - $monitor_unknown)/ $monitor_checks) * 100,1);
} else
$monitor_health = 100;
if ($data_checks > 0){
$data_health = format_numeric ( (($data_checks -($data_unknown + $data_alert)) / $data_checks ) * 100,1);;
} else
$data_health = 100;
if (($data_checks == 0) && ($data_checks == 0)){
$global_health = format_numeric( ((($monitor_ok -$monitor_alert - $monitor_unknown )+($data_checks -($data_unknown + $data_alert))) / ($data_checks + $monitor_checks) ) * 100, 1);
} else
$global_health = 100;
echo "<h2>".$lang_label["tactical_indicator"]."</h2>";
echo "<img src='reporting/fgraph.php?tipo=odo_tactic&value1=$global_health&value2=$data_health&value3=$monitor_health'>";

View File

@ -25,11 +25,15 @@ if (comprueba_login() == 0) {
if (give_acl($id_usuario, 0, "AR")==1) {
echo "<h2>".$lang_label["events"]." &gt; ";
echo $lang_label["event_statistics"]."<a href='help/".$help_code."/chap5.php#51' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h2>";
echo "<br><br>";
echo "<h2>".$lang_label["graph_event_total"]."</h2>";
echo '<img src="reporting/fgraph.php?tipo=total_events" border=0>';
echo "<br><br>";
echo "<h2>".$lang_label["graph_event_user"]."</h2>";
echo '<img src="reporting/fgraph.php?tipo=user_events" border=0>';
echo "<br><br>";
echo '<img src="reporting/fgraph.php?tipo=group_events" border=0>';
echo "<h2>".$lang_label["graph_event_group"]."</h2>";
echo '<img src="reporting/fgraph.php?tipo=group_events&width=300&height=200" border=0>';
echo "<br><br>";
} else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access event viewer");

View File

@ -160,27 +160,14 @@ if (isset($_POST["event"]))
$event = entrada_limpia($_POST["event"]);
echo "<h2>".$lang_label["events"]." &gt; ".$lang_label["event_main_view"]."<a href='help/".$help_code."/chap5.php#5' target='_help' class='help'>&nbsp;<span>".$lang_label["help"]."</span></a></h2>";
echo "<table cellpadding='4' cellspacing='4' class='databox'>";
echo "<tr>";
echo "<table width=100%>";
echo "<tr><td>";
echo "<table cellpadding='4' cellspacing='4' class='databox' >";
echo "<td colspan='2' valign='top'>";
echo "<h3>".$lang_label["filter"]."</h3>";
echo "</td>";
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
echo "<h3>".$lang_label["status"]."</h3>";
echo "<img src='images/dot_green.gif'> - ".$lang_label["validated_event"];
echo "<br>";
echo "<img src='images/dot_red.gif'> - ".$lang_label["not_validated_event"];
echo "</td>";
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
echo "<h3>".$lang_label["action"]."</h3>";
echo "<img src='images/ok.png'> - ".$lang_label["validate_event"];
echo "<br>";
echo "<img src='images/cross.png'> - ".$lang_label["delete_event"];
echo "<br>";
echo "<img src='images/page_lightning.png'> - ".$lang_label["create_incident"];
echo "</td></tr>";
echo "<tr>";
echo "<form method='post' action='index.php?sec=eventos&sec2=operation/events/events&refr=60'>";
echo "<tr><td>".$lang_label["group"]."</td>";
echo "<td>".$lang_label["group"]."</td>";
echo "<td>";
echo "<select name='ev_group' onChange='javascript:this.form.submit();' class='w130'>";
if ( $ev_group > 1 ){
@ -208,8 +195,16 @@ echo "</select>";
echo "</form>";
echo "<td valign='middle'>";
echo "<noscript><input type='submit' class='sub' value='".$lang_label["show"]."'></noscript>";
echo "</td></tr>";
echo "</td>";
echo "</table>";
echo "<td align='right'>";
echo "<table cellpadding=0 cellspacing=0 border=0>";
echo "<tr><td>";
echo "<img src='reporting/fgraph.php?tipo=group_events&width=300&height=130'>";
echo "</td></tr></table>";
echo "</table>";
echo "<br>";
// How many events do I have in total ?
@ -326,5 +321,21 @@ if ($total_events > 0){
echo "<input class='sub delete' type='submit' name='deletebt' value='".$lang_label["delete"]."'>";
}
echo "</form></table>";
echo "<table>";
echo "<tr>";
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
echo "<h3>".$lang_label["status"]."</h3>";
echo "<img src='images/dot_green.gif'> - ".$lang_label["validated_event"];
echo "<br>";
echo "<img src='images/dot_red.gif'> - ".$lang_label["not_validated_event"];
echo "</td>";
echo "<td rowspan='4' class='f9' style='padding-left: 30px; line-height: 17px; vertical-align: top;'>";
echo "<h3>".$lang_label["action"]."</h3>";
echo "<img src='images/ok.png'> - ".$lang_label["validate_event"];
echo "<br>";
echo "<img src='images/cross.png'> - ".$lang_label["delete_event"];
echo "<br>";
echo "<img src='images/page_lightning.png'> - ".$lang_label["create_incident"];
echo "</td></tr></table>";
} // no events to show
?>

View File

@ -363,12 +363,12 @@ if ($row2_count[0] <= 0 ) {
echo "<tr>";
echo "<th width='43'>ID</th>";
echo "<th>".$lang_label["status"]."</th>";
echo "<th width='165'>".$lang_label["incident"]."</th>";
echo "<th width='50'>".$lang_label["priority"]."</th>";
echo "<th >".$lang_label["incident"]."</th>";
echo "<th >".$lang_label["priority"]."</th>";
echo "<th>".$lang_label["group"]."</th>";
echo "<th width='150'>".$lang_label["updated_at"]."</th>";
echo "<th>".$lang_label["updated_at"]."</th>";
echo "<th>".$lang_label["source"]."</th>";
echo "<th width='75'>".$lang_label["in_openedby"]."</th>";
echo "<th width='50'>".$lang_label["in_openedby"]."</th>";
echo "<th>".$lang_label["delete"]."</th>";
$color = 1;
@ -418,8 +418,8 @@ if ($row2_count[0] <= 0 ) {
case 13: echo "<img src='images/dot_green.gif'>";
break;
}
echo "<td class='$tdcolor'><a href='index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id=".$row2["id_incidencia"]."'>".substr(salida_limpia($row2["titulo"]),0,25);
echo "<td class='$tdcolor'>";
echo "<td class='$tdcolor'><a href='index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id=".$row2["id_incidencia"]."'>".substr(salida_limpia($row2["titulo"]),0,45);
echo "<td class='$tdcolor' align='center'>";
switch ( $row2["prioridad"] ){
case 0: echo "<img src='images/dot_green.gif'>"."<img src='images/dot_green.gif'>"."<img src='images/dot_yellow.gif'>"; break;
case 1: echo "<img src='images/dot_green.gif'>"."<img src='images/dot_yellow.gif'>"."<img src='images/dot_yellow.gif'>"; break;
@ -436,10 +436,14 @@ if ($row2_count[0] <= 0 ) {
case 4: echo $lang_label["very_serious"]; break;
case 10: echo $lang_label["maintenance"]; break;
*/
echo "<td class='$tdcolor'>".dame_nombre_grupo($row2["id_grupo"]);
echo "<td class='$tdcolor'>".$row2["actualizacion"];
echo "<td class='$tdcolor' align='center'>";
$id_grupo = $row2["id_grupo"];
echo '<img src="images/groups_small/'.show_icon_group($id_grupo).'.png" title="'.dame_grupo($id_grupo).'">';
echo "<td class='$tdcolor'>".human_time_comparation($row2["actualizacion"]);
echo "<td class='$tdcolor'>".$row2["origen"];
echo "<td class='$tdcolor'><a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$row2["id_usuario"]."'><a href='#' class='tip'>&nbsp;<span>".dame_nombre_real($row2["id_usuario"])."</span></a>".substr($row2["id_usuario"], 0, 8)."</a></td>";
echo "<td class='$tdcolor'><a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$row2["id_usuario"]."'>".$row2["id_usuario"]."</td>";
$id_author_inc = $row2["id_usuario"];
if ((give_acl($id_usuario, $id_group, "IM") ==1) OR ($_SESSION["id_usuario"] == $id_author_inc) ){
// Only incident owners or incident manager

View File

@ -19,6 +19,19 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
?>
<script language="javascript">
/* Function to hide/unhide a specific Div id */
function toggleDiv (divid){
if (document.getElementById(divid).style.display == 'none'){
document.getElementById(divid).style.display = 'block';
} else {
document.getElementById(divid).style.display = 'none';
}
}
</script>
<?PHP
require("include/config.php");
if (comprueba_login() != 0) {
@ -68,7 +81,6 @@ if (isset($_GET["id"])){
// Note add
if (isset($_GET["insertar_nota"])){
$id_inc = entrada_limpia($_POST["id_inc"]);
$timestamp = entrada_limpia($_POST["timestamp"]);
$nota = entrada_limpia($_POST["nota"]);
@ -123,7 +135,7 @@ if (isset($_GET["id"])){
// Upload file
if ((give_acl($iduser_temp, $id_grupo, "IW")==1) AND isset($_GET["upload_file"])) {
if (( $_FILES['userfile']['name'] != "" ) && ($userfile != "none")){ //if file
if (( $_FILES['userfile']['name'] != "" )){ //if file
$tipo = $_FILES['userfile']['type'];
if (isset($_POST["file_description"]))
$description = $_POST["file_description"];
@ -331,18 +343,18 @@ echo "<td class='datos'><b>Creator</b>
if ((give_acl($iduser_temp, $id_grupo, "IM")==1) OR ($usuario == $iduser_temp)) {
echo '</select>
<tr><td class="datos2" colspan="4">
<textarea name="descripcion" rows="15" cols="85">';
<textarea name="descripcion" rows="15" cols="85" style="height: 300px;">';
} else {
echo '</select>
<tr><td class="datos2" colspan="4">
<textarea readonly name="descripcion" rows="15" cols="85">';
<textarea readonly name="descripcion" rows="15" cols="85" style="height: 300px;">';
}
if (isset($texto)) {
echo $texto;
}
echo "</textarea></td></tr>";
echo '</table><table width="600px">';
echo '</table><table width="650px">';
echo "<tr><td align='right'>";
// Only if user is the used who opened incident or (s)he is admin
@ -360,7 +372,7 @@ if ($creacion_incidente == 0){
echo "</form>";
if ($creacion_incidente == 0){
echo "<tr><td colspan='7' style='text-align: right;'>";
echo "<tr><td align='right'>";
echo '
<form method="post" action="index.php?sec=incidencias&sec2=operation/incidents/incident_note&id_inc='.$id_inc.'">
<input type="hidden" name="nota" value="add">
@ -370,11 +382,95 @@ if ($creacion_incidente == 0){
echo "</tr></table><br>";
if ($creacion_incidente == 0){
// Upload control
// ********************************************************************
// Notes
// ********************************************************************
$cabecera=0;
$sql4='SELECT * FROM tnota_inc WHERE id_incidencia = '.$id_inc;
$res4=mysql_query($sql4);
while ($row2=mysql_fetch_array($res4)){
if ($cabecera == 0) { // Show head only one time
echo "<h3>".$lang_label["in_notas_t1"]."</h3>";
echo "<table cellpadding='4' cellspacing='4' class='databox' width='650'>";
echo "<tr><td>";
$cabecera = 1;
}
$sql3='SELECT * FROM tnota WHERE id_nota = '.$row2["id_nota"].' ORDER BY timestamp DESC';
$res3=mysql_query($sql3);
while ($row3=mysql_fetch_array($res3)){
$timestamp = $row3["timestamp"];
$nota = $row3["nota"];
$id_usuario_nota = $row3["id_usuario"];
// Show data
echo '<tr><td rowspan="3" class="top"><img src="images/page_white_text.png"></td><td class="datos" width=40><b>'.$lang_label["author"].': </b><td class="datos">';
$usuario = $id_usuario_nota;
$nombre_real = dame_nombre_real($usuario);
echo $usuario." - (<i><a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$usuario."'>".$nombre_real."</a></i>)";
// Delete comment, only for admins
if ((give_acl($iduser_temp, $id_grupo, "IM")==1) OR ($usuario == $iduser_temp)) {
$myurl="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id=".$id_inc."&id_nota=".$row2["id_nota"]."&id_nota_inc=".$row2["id_nota_inc"];
echo '<td rowspan="3" class="top" width="60" align="center"><a href="'.$myurl.'"><img src="images/cross.png" align="middle" border="0"></a>';
}
echo '<tr><td class="datos"><b>'.$lang_label["date"].': </b><td class="datos"><i>'.$timestamp.'</i></td></tr>';
echo '<tr><td colspan="2" class="datos"> ';
echo '<table border="0" cellpadding="4" cellspacing="4" style="width: 580px">';
echo '<tr><td class="datos2" align="justify">';
echo salida_limpia ($nota);
echo "</td></tr>";
echo '</table>';
}
}
if ($cabecera == 1){
echo "</table>"; // note table
}
echo "</form></table>";
// ************************************************************
// Files attached to this incident
// ************************************************************
// Attach head if there's attach for this incident
$att_fil=mysql_query("SELECT * FROM tattachment WHERE id_incidencia = ".$id_inc);
if (mysql_num_rows($att_fil)){
echo "<h3>".$lang_label["attached_files"]."</h3>";
echo "<table cellpadding='4' cellspacing='4' class='databox' width='650'>";
echo "<tr>
<th class=datos>".$lang_label["filename"]."</th>
<th class=datos>".$lang_label["description"]."</th>
<th class=datos>".$lang_label["size"]."</th>
<th class=datos>".$lang_label["delete"]."</th></tr>";
while ($row=mysql_fetch_array($att_fil)){
echo "<tr><td class=datos><img src='images/disk.png' border=0 align='top'> &nbsp;&nbsp;<a target='_new' href='attachment/pand".$row["id_attachment"]."_".$row["filename"]."'><b>".$row["filename"]."</b></a>";
echo "<td class=datos>".$row["description"];
echo "<td class=datos>".$row["size"];
if (give_acl($iduser_temp, $id_grupo, "IM")==1){ // Delete attachment
echo '<td class=datos align="center"><a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'&delete_file='.$row["id_attachment"].'"><img src="images/cross.png" border=0>';
}
}
echo "</td></tr></table>";
}
// ************************************************************
// Upload control
// ************************************************************
// Upload control
if (give_acl($iduser_temp, $id_grupo, "IW")==1){
echo '
<h3>'.$lang_label["attachfile"].'</h3>
<table cellpadding="4" cellspacing="3" class="databox" width="400">
echo "<h3>".$lang_label["attachfile"];
?>
<A HREF="javascript:;" onmousedown="toggleDiv('file_control');">
<?PHP
echo "<img src='images/disk.png'>";
echo "</a></h3>";
echo "<div id='file_control' style='display:none'>";
echo '<table cellpadding="4" cellspacing="3" class="databox" width="400">
<tr>
<td class="datos">'.$lang_label["filename"].'</td>
<td class="datos"><form method="post" action="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'&upload_file=1" enctype="multipart/form-data">
@ -389,83 +485,10 @@ if ($creacion_incidente == 0){
<tr><td style="text-align: right;">
<input type="submit" name="upload" value="'.$lang_label["upload"].'" class="sub wand">
</td></tr></table><br>';
echo "</div>";
}
// ************************************************************
// Files attached to this incident
// ************************************************************
// Attach head if there's attach for this incident
$att_fil=mysql_query("SELECT * FROM tattachment WHERE id_incidencia = ".$id_inc);
if (mysql_num_rows($att_fil))
{
echo "<table cellpadding='4' cellspacing='4' class='data_box' width='650'>";
echo "<tr><td>";
echo "<h3>".$lang_label["attached_files"]."</h3>";
echo "</td></tr><td>";
echo "<table width='650'><tr>
<th class=datos>".$lang_label["filename"]."</th>
<th class=datos>".$lang_label["description"]."</th>
<th class=datos>".$lang_label["size"]."</th>
<th class=datos>".$lang_label["delete"]."</th></tr>";
while ($row=mysql_fetch_array($att_fil)){
echo "<tr><td class=datos><a target='_new' href='attachment/pand".$row["id_attachment"]."_".$row["filename"]."'><img src='images/file.gif' border=0 align='middle'> ".$row["filename"]."</a>";
echo "<td class=datos>".$row["description"];
echo "<td class=datos>".$row["size"];
if (give_acl($iduser_temp, $id_grupo, "IM")==1){ // Delete attachment
echo '<td class=datos align="center"><a href="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id='.$id_inc.'&delete_file='.$row["id_attachment"].'"><img src="images/delete.gif" border=0>';
}
}
echo "</td></tr></table></table><br>";
}
// ********************************************************************
// Notes
// ********************************************************************
$cabecera=0;
$sql4='SELECT * FROM tnota_inc WHERE id_incidencia = '.$id_inc;
$res4=mysql_query($sql4);
while ($row2=mysql_fetch_array($res4)){
if ($cabecera == 0) { // Show head only one time
echo "<table cellpadding='4' cellspacing='4' class='databox' width='550px'>";
echo "<tr><td>";
echo "<h3>".$lang_label["in_notas_t1"]."</h3>";
echo "<table cellpadding='' cellspacing='3' border='0'>";
echo "<tr><td>";
$cabecera = 1;
}
$sql3='SELECT * FROM tnota WHERE id_nota = '.$row2["id_nota"].' ORDER BY timestamp DESC';
$res3=mysql_query($sql3);
while ($row3=mysql_fetch_array($res3)){
$timestamp = $row3["timestamp"];
$nota = $row3["nota"];
$id_usuario_nota = $row3["id_usuario"];
// Show data
echo '<tr><td rowspan="3" class="top"><img src="images/nota.gif"></td><td class="datos" width=40><b>'.$lang_label["author"].': </b><td class="datos">';
$usuario = $id_usuario_nota;
$nombre_real = dame_nombre_real($usuario);
echo $usuario." - (<i><a href='index.php?sec=usuario&sec2=operation/users/user_edit&ver=".$usuario."'>".$nombre_real."</a></i>)";
// Delete comment, only for admins
if ((give_acl($iduser_temp, $id_grupo, "IM")==1) OR ($usuario == $iduser_temp)) {
$myurl="index.php?sec=incidencias&sec2=operation/incidents/incident_detail&id=".$id_inc."&id_nota=".$row2["id_nota"]."&id_nota_inc=".$row2["id_nota_inc"];
echo '<td rowspan="3" class="top" width="60" align="center"><a href="'.$myurl.'"><img src="images/delete.gif" align="middle" border="0"> '.$lang_label["delete"].'</a>';
}
echo '<tr><td class="datos"><b>'.$lang_label["date"].': </b><td class="datos"><i>'.$timestamp.'</i></td></tr>';
echo '<tr><td colspan="2" class="datos"> ';
echo '<table border="0" cellpadding="5" cellspacing="5" style="width: 450px"><tr><td class="f9" align="justify">';
echo salida_limpia($nota);
echo '</table>';
echo '<tr><td colspan="3"><div class="sep"></div></td></tr>';
}
}
if ($cabecera == 1){
echo "</table>"; // note table
}
echo "</form></table>";
} // create mode
?>

View File

@ -35,7 +35,7 @@ if (comprueba_login() == 0) {
echo "<td class='datos'>".$now."</td>";
echo "<input type='hidden' name='timestamp' value='".$now."'>";
echo "<input type='hidden' name='id_inc' value='".$id_inc."'>";
echo '<tr><td colspan="3" class="datos2"><textarea name="nota" rows="20" cols="80">';
echo '<tr><td colspan="3" class="datos2"><textarea name="nota" rows="20" cols="80" style="height: 300px;">';
echo '</textarea>';
echo '</td></tr>';
echo '</table><table width="550">';

View File

@ -210,16 +210,18 @@ if (give_acl($_SESSION["id_usuario"], 0, "AR")==1) {
}
echo '<ul class="mn"><li><a href="index.php?sec=snmpconsole&amp;sec2=operation/snmpconsole/snmp_view&amp;refr=30" class="mn">'.$lang_label["SNMP_console"].'</a></li></ul></div>';
// SNMP Console alert (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "snmpconsole"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_alert") {
echo "<div class='arrows'>";
} else {
echo "<div class='arrow'>";
if ((give_acl($_SESSION["id_usuario"], 0, "AW")==1)){
// SNMP Console alert (submenu)
if (isset($_GET["sec"]) && $_GET["sec"] == "snmpconsole"){
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/snmpconsole/snmp_alert") {
echo "<div class='arrows'>";
} else {
echo "<div class='arrow'>";
}
echo "<ul class='mn'><li><a href='index.php?sec=snmpconsole&amp;sec2=operation/snmpconsole/snmp_alert' class='mn'>".$lang_label["snmp_console_alert"]."</a></li></ul></div>";
}
echo "<ul class='mn'><li><a href='index.php?sec=snmpconsole&amp;sec2=operation/snmpconsole/snmp_alert' class='mn'>".$lang_label["snmp_console_alert"]."</a></li></ul></div>";
}
// Messages
if(isset($_GET["sec2"]) && $_GET["sec2"] == "operation/messages/message" && !isset($_GET["nuevo_g"])) {
echo '<div id="op7s">';

View File

@ -1,5 +1,7 @@
<?php
error_reporting(0);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**

View File

@ -616,6 +616,67 @@ function grafico_modulo_sparse ( $id_agente_modulo, $periodo, $show_event,
graphic_error ();
}
function generic_pie_graph ($width=300, $height=200, $data, $legend) {
require ("../include/config.php");
require_once 'Image/Graph.php';
require ("../include/languages/language_".$language_code.".php");
if (sizeof($data) > 0){
// create the graph
$driver=& Image_Canvas::factory('png',array('width'=>$width,'height'=>$height,'antialias' => 'native'));
$Graph = & Image_Graph::factory('graph', $driver);
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
// set the font size to 7 pixels
$Font->setSize(7);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(
Image_Graph::horizontal(
$Plotarea = Image_Graph::factory('plotarea'),
$Legend = Image_Graph::factory('legend'),
50
)
);
$Legend->setPlotarea($Plotarea);
// Create the dataset
// Merge data into a dataset object (sancho)
$Dataset1 =& Image_Graph::factory('dataset');
for ($a=0;$a < sizeof($data); $a++){
$Dataset1->addPoint($legend[$a], $data[$a]);
}
$Plot =& $Plotarea->addNew('pie', $Dataset1);
$Plotarea->hideAxis();
// create a Y data value marker
$Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_PCT_Y_TOTAL);
// create a pin-point marker type
$PointingMarker =& $Plot->addNew('Image_Graph_Marker_Pointing_Angular', array(1, &$Marker));
// and use the marker on the 1st plot
$Plot->setMarker($PointingMarker);
// format value marker labels as percentage values
$Marker->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%0.1f%%'));
$Plot->Radius = 15;
$FillArray =& Image_Graph::factory('Image_Graph_Fill_Array');
$Plot->setFillStyle($FillArray);
$FillArray->addColor('green@0.7');
$FillArray->addColor('yellow@0.7');
$FillArray->addColor('red@0.7');
$FillArray->addColor('orange@0.7');
$FillArray->addColor('blue@0.7');
$FillArray->addColor('purple@0.7');
$FillArray->addColor('lightgreen@0.7');
$FillArray->addColor('lightblue@0.7');
$FillArray->addColor('lightred@0.7');
$FillArray->addColor('grey@0.6', 'rest');
$Plot->explode(6);
$Plot->setStartingAngle(0);
// output the Graph
$Graph->done();
} else
graphic_error ();
}
function graphic_agentmodules($id_agent, $width, $height) {
include ("../include/config.php");
require_once 'Image/Graph.php';
@ -659,67 +720,10 @@ function graphic_agentmodules($id_agent, $width, $height) {
$bx++;
}
}
generic_pie_graph ($width, $height, $data2, $data_label2);
if ($cx > 0){
// create the graph
$driver=& Image_Canvas::factory('png',array('width'=>$width,'height'=>$height,'antialias' => 'native'));
$Graph = & Image_Graph::factory('graph', $driver);
//$Graph =& Image_Graph::factory('graph', array($width, $height));
// add a TrueType font
$Font =& $Graph->addNew('font', $config_fontpath);
// set the font size to 7 pixels
$Font->setSize(7);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(
Image_Graph::horizontal(
$Plotarea = Image_Graph::factory('plotarea'),
$Legend = Image_Graph::factory('legend'),
50
)
);
$Legend->setPlotarea($Plotarea);
// Create the dataset
// Merge data into a dataset object (sancho)
$Dataset1 =& Image_Graph::factory('dataset');
for ($a=0;$a < sizeof($data2); $a++){
$Dataset1->addPoint($data_label2[$a], $data2[$a]);
}
$Plot =& $Plotarea->addNew('pie', $Dataset1);
$Plotarea->hideAxis();
// create a Y data value marker
$Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_PCT_Y_TOTAL);
// create a pin-point marker type
$PointingMarker =& $Plot->addNew('Image_Graph_Marker_Pointing_Angular', array(1, &$Marker));
// and use the marker on the 1st plot
$Plot->setMarker($PointingMarker);
// format value marker labels as percentage values
$Marker->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%0.1f%%'));
$Plot->Radius = 15;
$FillArray =& Image_Graph::factory('Image_Graph_Fill_Array');
$Plot->setFillStyle($FillArray);
$FillArray->addColor('green@0.7');
$FillArray->addColor('yellow@0.7');
$FillArray->addColor('red@0.7');
$FillArray->addColor('orange@0.7');
$FillArray->addColor('blue@0.7');
$FillArray->addColor('purple@0.7');
$FillArray->addColor('lightgreen@0.7');
$FillArray->addColor('lightblue@0.7');
$FillArray->addColor('lightred@0.7');
$FillArray->addColor('grey@0.6', 'rest');
$Plot->explode(6);
$Plot->setStartingAngle(145);
// output the Graph
$Graph->done();
} else
graphic_error ();
}
function graphic_agentaccess($id_agent, $periodo, $width, $height){
include ("../include/config.php");
require_once 'Image/Graph.php';
@ -814,12 +818,8 @@ function graphic_agentaccess($id_agent, $periodo, $width, $height){
$Graph->done();
}
function grafico_incidente_estados() {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array(0,0,0,0);
@ -840,35 +840,19 @@ function grafico_incidente_estados() {
$data[3]=$data[3]+1;
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++)
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
$graph = new PieGraph(370,180,"auto");
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["incident_status"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->setShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.4);
$p1->SetCenter(0.3);
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++){
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
}
$legend = array ("Open Incident", "Closed Incident", "Outdated", "Invalid");
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
generic_pie_graph (370, 180,$data, $legend);
}
function grafico_incidente_prioridad() {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array(0,0,0,0,0,0);
@ -894,95 +878,57 @@ function grafico_incidente_prioridad() {
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++)
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
$graph = new PieGraph(370,180,"auto");
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["incident_priority"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.4);
$p1->SetCenter(0.3);
$legend = array ("Informative","Low","Medium","Serious", "Very serious", "Maintance");
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++)
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
$legend = array ("Informative","Low","Medium","Serious", "Very serious", "Maintance");
generic_pie_graph (320, 200, $data, $legend);
}
function graphic_incident_group() {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array();
$legend = array();
$sql1="SELECT distinct id_grupo FROM tincidencia ";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
$sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_grupo = ".$row[0];
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = dame_nombre_grupo($row[0])."(".$row2[0].")";
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++){
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
$data = array();
$legend = array();
$sql1="SELECT distinct id_grupo FROM tincidencia ";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
$sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_grupo = ".$row[0];
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = dame_nombre_grupo($row[0])."(".$row2[0].")";
}
$ajuste_altura = sizeof($data) * 20;
$graph = new PieGraph(370,80+$ajuste_altura,'auto');
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["incident_group"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.25);
$p1->SetCenter(0.3);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++){
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
}
generic_pie_graph (320, 200, $data, $legend);
}
function graphic_incident_user() {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array();
@ -990,57 +936,38 @@ function graphic_incident_user() {
$sql1="SELECT distinct id_usuario FROM tincidencia ";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
$sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_usuario = '".$row[0]."'";
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = $row[0]."(".$row2[0].")";
$sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE id_usuario = '".$row[0]."'";
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = $row[0]."(".$row2[0].")";
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++){
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
}
$ajuste_altura = sizeof($data) * 20;
$graph = new PieGraph(370,80+$ajuste_altura,'auto');
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["incident_user"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.25);
$p1->SetCenter(0.3);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++){
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
}
generic_pie_graph (320, 200, $data, $legend);
}
function graphic_user_activity() {
function graphic_user_activity($width=300, $height=200) {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array();
@ -1048,12 +975,12 @@ function graphic_user_activity() {
$sql1="SELECT DISTINCT ID_usuario FROM tsesion ";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
$entrada= entrada_limpia($row[0]);
$sql1='SELECT COUNT(ID_usuario) FROM tsesion WHERE ID_usuario = "'.$entrada.'"';
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = substr($row[0],0,16)."(".$row2[0].")";
$entrada= entrada_limpia($row[0]);
$sql1='SELECT COUNT(ID_usuario) FROM tsesion WHERE ID_usuario = "'.$entrada.'"';
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = substr($row[0],0,16)."(".$row2[0].")";
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
@ -1070,91 +997,56 @@ function graphic_user_activity() {
}
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++){
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
}
$ajuste_altura = sizeof($data) * 20;
$graph = new PieGraph(500,80+$ajuste_altura,'auto');
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["users_statistics"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.25);
$p1->SetCenter(0.3);
$p1->SetLegends($legend);
$graph->legend->Pos(0.05,0.49,"right","center");
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
// Take only the first 5 items
if (sizeof($data) >= 5){
for ($a=0;$a < 5;$a++){
$legend2[]= $legend[$a];
$data2[] = $data[$a];
}
generic_pie_graph ($width, $height, $data2, $legend2);
} else
generic_pie_graph ($width, $height, $data, $legend);
}
function graphic_incident_source() {
function graphic_incident_source ($width=320, $height=200) {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array();
$legend = array();
$sql1="SELECT DISTINCT origen FROM tincidencia";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
$sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE origen = '".$row[0]."'";
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = $row[0]."(".$row2[0].")";
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++){
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
}
$ajuste_altura = sizeof($data) * 20;
$graph = new PieGraph(370,80+$ajuste_altura,'auto');
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["incident_source"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.25);
$p1->SetCenter(0.3);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
$data = array();
$legend = array();
$sql1="SELECT DISTINCT origen FROM tincidencia";
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){
$sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE origen = '".$row[0]."'";
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2);
$data[] = $row2[0];
$legend[] = $row[0]."(".$row2[0].")";
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
// Take only the first 5 items
if (sizeof($data) >= 5){
for ($a=0;$a < 5;$a++){
$legend2[]= $legend[$a];
$data2[] = $data[$a];
}
generic_pie_graph ($width, $height, $data2, $legend2);
} else
generic_pie_graph ($width, $height, $data, $legend);
}
function grafico_db_agentes_modulos() {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
@ -1222,11 +1114,8 @@ function grafico_db_agentes_modulos() {
}
function grafico_eventos_usuario() {
function grafico_eventos_usuario( $width=320, $height=200) {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array();
@ -1243,49 +1132,31 @@ function grafico_eventos_usuario() {
}
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($a=0;$a < sizeof($data); $a++)
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$ajuste_altura = sizeof($data) * 17;
$graph = new PieGraph(430,170+$ajuste_altura,"auto");
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["events_per_user"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.2);
$p1->SetCenter(0.3);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
// Take only the first 5 items
if (sizeof($data) >= 5){
for ($a=0;$a < 5;$a++){
$legend2[]= $legend[$a];
$data2[] = $data[$a];
}
generic_pie_graph ($width, $height, $data2, $legend2);
} else
generic_pie_graph ($width, $height, $data, $legend);
}
function grafico_eventos_total() {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/config.php");
require ("../include/languages/language_".$language_code.".php");
$data = array();
@ -1307,47 +1178,29 @@ function grafico_eventos_total() {
$legend[] = "Not Revised ( $row[0] )";
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor=0; $mayor_data=0;
for ($a=0;$a < sizeof($data); $a++)
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
$graph = new PieGraph(430,200,"auto");
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["event_total"]." ( $total )");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.4);
$p1->SetCenter(0.28);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
for ($a=0;$a < sizeof($data); $a++)
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
generic_pie_graph (320, 200, $data, $legend);
}
function grafico_eventos_grupo() {
function grafico_eventos_grupo ($width = 300, $height = 200 ) {
include ("../include/config.php");
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_pie.php");
include ("jpgraph/jpgraph_pie3d.php");
require ("../include/languages/language_".$language_code.".php");
$data = array();
@ -1364,42 +1217,27 @@ function grafico_eventos_grupo() {
}
}
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :)
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
$mayor=0; $mayor_data=0;
for ($a=0;$a < sizeof($data); $a++)
if ($data[$a] > $mayor_data){
$mayor = $a;
$mayor_data = $data[$a];
}
$total_grupos = sizeof($data);
$ajuste_altura = $total_grupos * 10;
$graph = new PieGraph(430,150+$ajuste_altura,"auto");
$graph->SetMarginColor('white@0.2');
$graph->title->Set($lang_label["events_per_group"]);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetShadow();
$graph->SetAlphaBlending();
$graph->SetFrame(true);
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice($mayor);
$p1->SetSize(0.35);
$p1->SetCenter(0.28);
$p1->SetLegends($legend);
$graph->Add($p1);
$graph->img->SetAntiAliasing();
$graph->Stroke();
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($a=0;$a < sizeof($data);$a++){
for ($b=$a; $b <sizeof($data); $b++)
if ($data[$b] > $data[$a]){
$temp = $data[$a];
$temp_label = $legend[$a];
$data[$a] = $data[$b];
$legend[$a] = $legend[$b];
$data[$b] = $temp;
$legend[$b] = $temp_label;
}
}
// Take only the first x items
if (sizeof($data) >= 7){
for ($a=0;$a < 7;$a++){
$legend2[]= $legend[$a];
$data2[] = $data[$a];
}
generic_pie_graph ($width, $height, $data2, $legend2);
} else
generic_pie_graph ($width, $height, $data, $legend);
}
function grafico_db_agentes_paquetes() {
@ -1456,7 +1294,7 @@ function grafico_db_agentes_paquetes() {
$graph->xaxis->SetLabelMargin(5);
$graph->Set90AndMargin(100,20,50,30);
$p1 = new BarPlot($data);
$p1->value->SetFormat('%.0f ');
$p1->value->SetFormat('%.0f ');
$p1->value->Show();
$p1->value->SetAlign('left','center');
$p1->SetFillColor("#0000fd");
@ -1968,7 +1806,7 @@ if (isset($_GET["tipo"])){
elseif ($_GET["tipo"] =="db_agente_purge")
grafico_db_agentes_purge(-1, $width, $height);
elseif ($_GET["tipo"] =="group_events")
grafico_eventos_grupo();
grafico_eventos_grupo($width, $height);
elseif ($_GET["tipo"] =="user_events")
grafico_eventos_usuario();
elseif ($_GET["tipo"] =="total_events")
@ -1980,7 +1818,7 @@ if (isset($_GET["tipo"])){
elseif ($_GET["tipo"] =="source_incident")
graphic_incident_source();
elseif ($_GET["tipo"] =="user_activity")
graphic_user_activity();
graphic_user_activity($width,$height);
elseif ($_GET["tipo"] == "agentaccess")
graphic_agentaccess($_GET["id"], $_GET["periodo"], $width, $height);
elseif ($_GET["tipo"] == "agentmodules")