2007-05-03 Sancho Lerena <slerena@artica.es>
* include/FreeSans.ttf: Added to repos, should be here to use in graphs. * include/functions_db.php: Deleted noaccess include from comprueba_login(). This should return value, not render pages or exit. * include/config.inc.php: Modified some typos. * include/calendar.js: Added generic calendar javascript, to be used on exportdata and incident management code. * include/languages/language_en.php: More strings. * install.php: In my render, box height is too low. PLEASE recheck before changing this kind of properties because in other browsers could have a bad render (Sophus!). * index.php: Added script call (need to be done on header). * operation/agentes/export_csv.php: Added new file to create a standalone CSV on download icon / link. * operation/agentes/exportdata.php: New export data code, used some code from Leando Doctors, and mixed with old code. Now have three options to render export data. * operation/agentes/datos_agente_calendar.php: Deleted old code from Leandro. * operation/active_console/lib/extra_functions.php: Solved a lot of warnings, but there are TONS of more warnings that need to be corrected. * operation/active_console/lib/db_functions.php:Solved a lot of warnings, but there are TONS of more warnings that need to be corrected. * operation/active_console/index.php: Solved a lot of warnings, but there are TONS of more warnings that need to be corrected. This code DONT work if you are showing warning/notice erros. This code is not ready for production usage, too buggy yet :( * pandora_graphical_console_data.sql: Cleanup. * godmode/agentes/module_manager.php: Added wizard button. * pandora_graphical_console.sql: Cleanup. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@448 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
e0dcb1697f
commit
0ff4b2ee42
|
@ -1,18 +1,60 @@
|
|||
2007-04-22 slerena <slerena@artica.es>
|
||||
2007-05-03 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandoradb.sql: Fixed small problem with tgrupos
|
||||
* include/FreeSans.ttf: Added to repos, should be here to use in graphs.
|
||||
|
||||
* include/functions_db.php: Deleted noaccess include from
|
||||
comprueba_login(). This should return value, not render pages or
|
||||
exit.
|
||||
|
||||
* include/config.inc.php: Modified some typos.
|
||||
|
||||
* include/calendar.js: Added generic calendar javascript, to be
|
||||
used on exportdata and incident management code.
|
||||
|
||||
* include/languages/language_en.php: More strings.
|
||||
|
||||
* install.php: In my render, box height is too low. PLEASE recheck
|
||||
before changing this kind of properties because in other browsers
|
||||
could have a bad render (Sophus!).
|
||||
|
||||
* index.php: Added script call (need to be done on header).
|
||||
|
||||
* operation/agentes/export_csv.php: Added new file to create a
|
||||
standalone CSV on download icon / link.
|
||||
|
||||
* operation/agentes/exportdata.php: New export data code, used
|
||||
some code from Leando Doctors, and mixed with old code. Now have
|
||||
three options to render export data.
|
||||
|
||||
* operation/agentes/datos_agente_calendar.php: Deleted old code from Leandro.
|
||||
|
||||
* operation/active_console/lib/extra_functions.php: Solved a lot
|
||||
of warnings, but there are TONS of more warnings that need to be
|
||||
corrected.
|
||||
|
||||
* operation/active_console/lib/db_functions.php:Solved a lot of
|
||||
warnings, but there are TONS of more warnings that need to be
|
||||
corrected.
|
||||
|
||||
* operation/active_console/index.php: Solved a lot of warnings,
|
||||
but there are TONS of more warnings that need to be
|
||||
corrected. This code DONT work if you are showing warning/notice
|
||||
erros. This code is not ready for production usage, too buggy yet
|
||||
:(
|
||||
|
||||
* pandora_graphical_console_data.sql: Cleanup.
|
||||
|
||||
* godmode/agentes/module_manager.php: Added wizard button.
|
||||
|
||||
* pandora_graphical_console.sql: Cleanup.
|
||||
|
||||
|
||||
2007-04-22 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandoradb.sql: Fixed small problem with tgrupos
|
||||
|
||||
2007-05-01 Raul Mateos <raulofpandora@gmail.com>
|
||||
|
||||
* functions_db.php, language_en.php, estado_grupo.php
|
||||
estado_agente.php configurar_grupo.php lista_grupos.php
|
||||
modificar_server.php: New feature implemented: groups could be
|
||||
configured to do not launch alerts (Disabled field). Any agent
|
||||
inside this group does not fire alerts while disabled will be
|
||||
activated. Useful for programmed non-service periods or programmed
|
||||
shutdowns.
|
||||
|
||||
* images/bricks.png: Changed red colour to orange one.
|
||||
|
||||
* include/pandora.css: Changed background colour for View Mode tab.
|
||||
|
@ -44,7 +86,6 @@
|
|||
|
||||
* operation/modificar_agente.php: Deleted table and moved button to tr.
|
||||
|
||||
>>>>>>> .r446
|
||||
2007-04-22 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* functions_db.php, language_en.php, estado_grupo.php
|
||||
|
@ -92,7 +133,6 @@
|
|||
|
||||
* godmode/menu.php: Fixed some navigation marks.
|
||||
|
||||
>>>>>>> .r441
|
||||
2007-04-19 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* pandora.css: added some classes for graphical input buttons.
|
||||
|
|
|
@ -398,9 +398,9 @@ if (isset($_POST["oid"])){
|
|||
<?php
|
||||
echo "<td colspan=5 align='right'>";
|
||||
if ($update_module == "1"){
|
||||
echo '<input name="updbutton" type="submit" class="sub" value="'.$lang_label["update"].'">';
|
||||
echo '<input name="updbutton" type="submit" class="sub next" value="'.$lang_label["update"].'">';
|
||||
} else {
|
||||
echo '<input name="crtbutton" type="submit" class="sub" value="'.$lang_label["add"].'">';
|
||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.$lang_label["add"].'">';
|
||||
}
|
||||
echo "</form>";
|
||||
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -30,10 +30,10 @@ $pandora_version="v1.3 devel";
|
|||
//$dbhost="localhost"; // MySQL Host
|
||||
|
||||
// This is used for reporting, please add "/" character at the end
|
||||
//$config_homedir = "/var/www/babel_console/";
|
||||
//$config_homedir = "/var/www/pandora_console/";
|
||||
|
||||
// Do not display any ERROR
|
||||
//error_reporting(0);
|
||||
//error_reporting(0); // Need to use active console at this moment
|
||||
|
||||
// Display ALL errors
|
||||
error_reporting(E_ALL);
|
||||
|
|
|
@ -638,7 +638,6 @@ function comprueba_login() {
|
|||
return 0 ;
|
||||
}
|
||||
}
|
||||
require("general/noaccess.php");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1069,5 +1068,19 @@ function give_agent_id_from_module_id ($id_module){
|
|||
return $pro;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Generic access to a field ($field) given a table
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
function give_db_value ($field, $table, $field_search, $condition_value){
|
||||
global $config;
|
||||
$query = "SELECT $field FROM $table WHERE $field_search = '$condition_value' ";
|
||||
$resq1 = mysql_query($query);
|
||||
if ($rowdup = mysql_fetch_array($resq1))
|
||||
$pro = $rowdup[0];
|
||||
else
|
||||
$pro = "";
|
||||
return $pro;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -768,8 +768,21 @@ $lang_label["text"]="Text";
|
|||
$lang_label["delete_data_above"]="Delete data above";
|
||||
$lang_label["enabled"]="Enabled";
|
||||
|
||||
// 3 may 2007
|
||||
$lang_label["csv"] = "Standalone CSV ascii file";
|
||||
$lang_label["average_per_hourday"] = "Average per hour/day";
|
||||
$lang_label["datatable"] = "Data table";
|
||||
$lang_label["export_type"] = "Export type";
|
||||
|
||||
|
||||
$lang_label["sunday"]="Sunday";
|
||||
$lang_label["monday"]="Monday";
|
||||
$lang_label["tuesday"]="Tuesday";
|
||||
$lang_label["wednesday"]="Wednesday";
|
||||
$lang_label["thurdsday"]="Thurdsday";
|
||||
$lang_label["friday"]="Friday";
|
||||
$lang_label["saturday"]="Saturday";
|
||||
$lang_label["hr"]="Hr";
|
||||
$lang_label["get_file"]="Download file";
|
||||
global $lang_label;
|
||||
global $help_label;
|
||||
?>
|
||||
|
|
|
@ -296,8 +296,8 @@ $lang_label["add"]="Añadir";
|
|||
$lang_label["db_purge_event"]="Limpieza de la Base de Datos de eventos";
|
||||
$lang_label["db_event"]="BBDD de eventos";
|
||||
$lang_label["max_min"]="Máx/Mín";
|
||||
$lang_label["max"]="Máximo";
|
||||
$lang_label["min"]="Mínimo";
|
||||
$lang_label["max"]="M<EFBFBD>ximo";
|
||||
$lang_label["min"]="M<EFBFBD>nimo";
|
||||
$lang_label["med"]="Media";
|
||||
$lang_label["month_graph"]="Gráfico mensual";
|
||||
$lang_label["week_graph"]="Gráfico semanal";
|
||||
|
@ -356,8 +356,8 @@ $lang_label["manage_config"]="Gestionar conf.";
|
|||
$lang_label["config_manage"]="Gestión de Configuraciones";
|
||||
$lang_label["get_info"]="Obtener info.";
|
||||
|
||||
$lang_label["are_you_sure"]="¿Está usted seguro?";
|
||||
$lang_label["users_msg"]="Los perfiles de usuario en Pandora definen qué usuarios pueden acceder a Pandora y que puede hacer cada uno. Los grupos definen elementos en común, cada usuario puede pertenecer a uno o más grupos, y tiene asignado un perfil a cada grupo que pertenezca. Un perfil es una lista de lo que puede y no puede hacer cada grupo, como por ejemplo «ver incidentes» o «gestionar bases de datos». Abajo se muestra una lista de los perfiles disponibles (definidos por los administradores locales de Pandora)";
|
||||
$lang_label["are_you_sure"]="<EFBFBD>Está usted seguro?";
|
||||
$lang_label["users_msg"]="Los perfiles de usuario en Pandora definen qué usuarios pueden acceder a Pandora y que puede hacer cada uno. Los grupos definen elementos en común, cada usuario puede pertenecer a uno o más grupos, y tiene asignado un perfil a cada grupo que pertenezca. Un perfil es una lista de lo que puede y no puede hacer cada grupo, como por ejemplo <EFBFBD>ver incidentes<65> o <20>gestionar bases de datos<6F>. Abajo se muestra una lista de los perfiles disponibles (definidos por los administradores locales de Pandora)";
|
||||
|
||||
$help_label["users_msg1"]="Este usuario es especial y tiene permiso para todo, pasando por encima de los privilegios asignados mediante grupos/perfiles";
|
||||
$help_label["users_msg2"]="Este usuario tiene permisos segregados para ver datos en los agente de su grupo, crear incidentes dentro de aquellos grupos sobre los que tenga acceso y añadir notas en incidentes propios o de terceros";
|
||||
|
@ -454,7 +454,7 @@ $lang_label["inagent"]=" en el agente ";
|
|||
$lang_label["you_must_select_modules"]="Se deben seleccionar módulos y/o alertas como objeto de la copia";
|
||||
$lang_label["packets_by_date"]="Paquetes por rangos de fecha";
|
||||
$lang_label["packets_by_agent"]="Paquetes por agente";
|
||||
$lang_label["modules_per_agent"]="Módulos por agente"; // Graphic title, dont use tildes
|
||||
$lang_label["modules_per_agent"]="M<EFBFBD>dulos por agente"; // Graphic title, dont use tildes
|
||||
$lang_label["event_total"]="Eventos totales";
|
||||
$lang_label["events_per_user"]="Eventos por usuario";
|
||||
$lang_label["events_per_group"]="Eventos por grupo";
|
||||
|
@ -537,7 +537,7 @@ $lang_label["validate"]="Validar";
|
|||
$lang_label["incident_user"]="Autores de los incidentes";
|
||||
$lang_label["incident_source"]="Origenes de los incidentes";
|
||||
$lang_label["incident_group"]="Grupos de los incidentes";
|
||||
$lang_label["users_statistics"]="Estadísticas de actividad de los usuarios";
|
||||
$lang_label["users_statistics"]="Estad<EFBFBD>sticas de actividad de los usuarios";
|
||||
$lang_label["update_user_ok"]="Usuario actualizado correctamente";
|
||||
|
||||
$lang_label["agent_detail"]="Detalle agente";
|
||||
|
@ -665,6 +665,7 @@ $lang_label["no_rtask"]="No hay ninguna tarea de reconocimiento configurada";
|
|||
//3 Apr 2007
|
||||
$lang_label["no_netprofiles"]="No hay ningún perfil de red definido";
|
||||
|
||||
|
||||
global $lang_label;
|
||||
global $help_label;
|
||||
?>
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Main PHP/SQL code development and project architecture and management
|
||||
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// CSS and some PHP additions
|
||||
// CSS and some PHP code additions
|
||||
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
|
||||
// Javascript Active Console code.
|
||||
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
|
||||
// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
|
||||
// Additions to code for Pandora FMS 1.2 graph code and new XML reporting template managemement
|
||||
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -25,9 +25,7 @@
|
|||
|
||||
// Pandora FMS 1.x uses icons from famfamfam, licensed under CC Atr. 2.5
|
||||
// Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/
|
||||
|
||||
// Pandora FMS 1.x uses Pear Image::Graph code
|
||||
|
||||
// Pandora FMS shares much of it's code with project Babel Enterprise, also a
|
||||
// FreeSoftware Project coded by some of the people who makes Pandora FMS
|
||||
|
||||
|
@ -94,6 +92,7 @@ if (isset ($_GET["refr"])){
|
|||
<meta name="robots" content="index, follow">
|
||||
<link rel="icon" href="images/pandora.ico" type="image/ico">
|
||||
<link rel="stylesheet" href="include/styles/pandora.css" type="text/css">
|
||||
<script type='text/JavaScript' src='include/calendar.js'></script>
|
||||
</head>
|
||||
|
||||
<?php
|
||||
|
|
|
@ -227,7 +227,7 @@ function install_step3() {
|
|||
echo "
|
||||
<div align='center' class='mt35'>
|
||||
<h1>Pandora FMS console installation wizard. Step #3 of 4 </h1>
|
||||
<div id='wizard' style='height: 540px;'>
|
||||
<div id='wizard' style='height: 580px;'>
|
||||
<div id='install_box'>
|
||||
<h1>Environment and database setup</h1>
|
||||
<p>
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require("../../include/config.php");
|
||||
// If you activate error reporting, Active Console don't work
|
||||
// because it has MANY warnings and other kind of errors
|
||||
|
||||
error_reporting(0);
|
||||
global $dbname;
|
||||
global $dbuser;
|
||||
global $dbpassword;
|
||||
|
@ -44,7 +48,8 @@ session_start();
|
|||
|
||||
<?php // Add this line to refresh each X seconds
|
||||
// *TODO* Adjust a variable interval
|
||||
if ($_GET["mode"] == "monitor"){
|
||||
|
||||
if (isset($_GET["mode"]) && $_GET["mode"] == "monitor"){
|
||||
echo ("<meta http-equiv=\"refresh\" content=\"10\">");
|
||||
}
|
||||
?>
|
||||
|
@ -256,7 +261,7 @@ while ($vista=mysql_fetch_array($vistas)){ //recorremos las vistas y creamos un
|
|||
|
||||
// Creamos las instancias de los objetos (que se corresponderan con los ids de los divs html)
|
||||
$i=1;
|
||||
//global $aObjetos;
|
||||
$aObjetos = array();
|
||||
//mysql_data_seek($objetos,0);
|
||||
|
||||
$objetos = dameObjetosVista($vista["idVista"]);
|
||||
|
@ -301,53 +306,22 @@ while ($vista=mysql_fetch_array($vistas)){ //recorremos las vistas y creamos un
|
|||
|
||||
$i=$i+1;
|
||||
}
|
||||
|
||||
// echo "var jg_doc = new jsGraphics();
|
||||
//
|
||||
// jg_doc.setColor('#ff0000'); // red
|
||||
// jg_doc.drawLine(10, 113, 220, 55); // co-ordinates related to 'myCanvas'
|
||||
// jg_doc.setColor('#0000ff'); // blue
|
||||
// jg_doc.fillRect(110, 120, 30, 60);
|
||||
// jg_doc.paint();
|
||||
// ";
|
||||
|
||||
|
||||
}
|
||||
//$objetos = dameObjetos();
|
||||
// echo "var aObjeto_count = 0;";
|
||||
// echo "aObjeto_count=1;";
|
||||
//echo "aObjeto = new Array(), aObjeto_count =".mysql_num_rows($objetos).";";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo "
|
||||
|
||||
|
||||
var tpg2;
|
||||
|
||||
tpg2 = new xTabPanelGroup('tpg2', 1000, 1000, 25, 'tabPanel', 'tabGroup', 'tabDefault', 'tabSelected');
|
||||
|
||||
|
||||
tpg2.select(parseInt(vistaActiva)+1);
|
||||
|
||||
FormSetup();
|
||||
|
||||
var tpg2;
|
||||
tpg2 = new xTabPanelGroup('tpg2', 1000, 1000, 25, 'tabPanel', 'tabGroup', 'tabDefault', 'tabSelected');
|
||||
tpg2.select(parseInt(vistaActiva)+1);
|
||||
FormSetup();
|
||||
}
|
||||
";
|
||||
|
||||
|
||||
|
||||
$vista_activa=obtenerVistaActiva();
|
||||
// Obtenemos la acción a realizar mediante los parametros GET y el nombre "action"
|
||||
|
||||
|
||||
// Una vez aparecido el formulario añadimos a la base de datos, los valores recogidos
|
||||
if ($_GET["action"]=="addagent")
|
||||
{
|
||||
if ($_GET["action"]=="addagent"){
|
||||
|
||||
$aSub[0]=$_POST["vista_MG"]; // Crear el objeto en forma de vista y que se cree una vista con los grupos de modulos que lo forman
|
||||
$aSub[1]=$_POST["vista_M"]; // Crear el objeto en forma de vista y que se cree una vista con los modulos que lo forman
|
||||
|
||||
|
@ -1250,7 +1224,7 @@ $perfil = obtenerPerfilActivo();
|
|||
// Obtenemos las vistas asignadas al perfil especial activo con id igual a 2 y creamos un array JavaScript que contendrá las Vistas
|
||||
$vistas = dameVistasPerfilActivas($perfil);
|
||||
// mysql_data_seek($vistas,0);
|
||||
while ($vista=mysql_fetch_array($vistas)){
|
||||
if ($vista=mysql_fetch_array($vistas)){
|
||||
$datos_vista=dameVista($vista["idVista"]);
|
||||
$estado_vista=dameEstadoVista($vista["idVista"]);
|
||||
$css_estado_vista="";
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,29 +1,26 @@
|
|||
<?php
|
||||
|
||||
// Pandora - the Free monitoring system
|
||||
// ====================================
|
||||
// Copyright (c) Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
|
||||
// Copyright (c) INDISEG S.L, contacto[AT]indiseg[DOT]net www.indiseg.net
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Main PHP/SQL code development and project architecture and management
|
||||
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// CSS and some PHP code additions
|
||||
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
|
||||
// Javascript Active Console code.
|
||||
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
|
||||
// Additions to code for Pandora FMS 1.2 graph code and new XML reporting template managemement
|
||||
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
|
||||
//
|
||||
$graphURL="http://".$_SERVER['SERVER_NAME']."/reporting/fgraph.php";
|
||||
|
||||
function obtenerVistaActiva()
|
||||
{
|
||||
|
||||
{
|
||||
// Obtenemos la cookie estado y consultamos cual es la vista activa
|
||||
$cookieVista = $_COOKIE["estado"];
|
||||
if (isset($_COOKIE["estado"]))
|
||||
$cookieVista = $_COOKIE["estado"];
|
||||
else
|
||||
$cookieVista = null;
|
||||
|
||||
if ($cookieVista != null)
|
||||
{
|
||||
|
@ -75,41 +72,29 @@ function obtenerVistaActiva()
|
|||
|
||||
}
|
||||
|
||||
function obtenerPerfilActivo()
|
||||
{
|
||||
|
||||
|
||||
function obtenerPerfilActivo(){
|
||||
// Obtenemos la cookie estado y consultamos cual es la vista activa
|
||||
$cookiePerfil = $_COOKIE["estado"];
|
||||
if (isset($_COOKIE["estado"]))
|
||||
$cookiePerfil = $_COOKIE["estado"];
|
||||
else
|
||||
$cookiePerfil = null;
|
||||
|
||||
if ($cookiePerfil != null)
|
||||
{
|
||||
if ($cookiePerfil != null){
|
||||
$params = explode("&" ,$cookiePerfil);
|
||||
for ($i=0; $i<sizeof($params);$i++)
|
||||
{
|
||||
|
||||
for ($i=0; $i<sizeof($params);$i++){
|
||||
$name_data= explode("=",$params[$i]);
|
||||
|
||||
if ($name_data[0] == "perfil_activo")
|
||||
{
|
||||
|
||||
$perfil = $name_data[1];
|
||||
|
||||
if ($name_data[0] == "perfil_activo"){
|
||||
$perfil = $name_data[1];
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
|
||||
} else {
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// $usuario = dameUsuarioActivo(); Es una fase que siemrpe retorna admin hay que implementarla bien cuando se haga la integración real con Pandora
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
$usuario="admin";
|
||||
$estado_consola=dameEstadoConsola($usuario);
|
||||
$perfil=$estado_consola["idPerfilActivo"];
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $perfil;
|
||||
|
||||
|
||||
|
@ -138,12 +123,9 @@ return $perfil;*/
|
|||
}
|
||||
|
||||
|
||||
function dameCajaImagenes($dir)
|
||||
{
|
||||
function dameCajaImagenes($dir){
|
||||
// $dir = "../imagenes/";
|
||||
|
||||
$resultado="";
|
||||
|
||||
// Open a known directory, and proceed to read its contents
|
||||
if (is_dir($dir)) {
|
||||
if ($dh = opendir($dir)) {
|
||||
|
@ -159,75 +141,44 @@ function dameCajaImagenes($dir)
|
|||
}
|
||||
closedir($dh);
|
||||
$resultado .= "+ \"</select>\"
|
||||
+ \"<BR>\"
|
||||
|
||||
|
||||
|
||||
";
|
||||
+ \"<BR>\" ";
|
||||
}
|
||||
}
|
||||
|
||||
return $resultado;
|
||||
|
||||
}
|
||||
|
||||
// Devuelve codigo html que crea una caja de texto con un checkbox. Este checkbox será utilizado cuando se desean añadir un elemento y que automaticamente cree una vista con los subelementos de los que esta compuesto
|
||||
function dameCheckboxAutoVistas($tipo)
|
||||
{
|
||||
$result="";
|
||||
|
||||
switch ($tipo) {
|
||||
case "A": //agente
|
||||
$result=" + \"<BR><input type=\'checkbox\' id=vista_MG name=\'vista_MG\' value=\'vista_MG\'> <label for=vista_MG>Crear vista con grupos de modulos </label> \"";
|
||||
$result.=" + \"<BR><input type=\'checkbox\' id=vista_M name=\'vista_M\' value=\'vista_M\'> <label for=vista_M>Crear vista con modulos </label><br> \"";
|
||||
break;
|
||||
case "GA": //Grupo Agentes
|
||||
$result=" + \"<BR><input type=\'checkbox\' id=vista_A name=\'vista_A\' value=\'vista_A\'> <label for=vista_A>Crear vista con agentes </label><br> \"";
|
||||
$result.=" + \"<BR><input type=\'checkbox\' id=vista_MG name=\'vista_MG\' value=\'vista_MG\'> <label for=vista_MG>Crear vista con grupos de modulos </label> \"";
|
||||
$result.=" + \"<BR><input type=\'checkbox\' id=vista_M name=\'vista_M\' value=\'vista_M\'> <label for=vista_M>Crear vista con modulos </label><br> \"";
|
||||
break;
|
||||
case "M": //Modulo
|
||||
//
|
||||
break;
|
||||
case "GM": //Grupo Modulos
|
||||
$result=" + \"<BR><input type=\'checkbox\' id=vista_M name=\'vista_M\' value=\'vista_M\'> <label for=vista_M>Crear vista con modulos </label><br> \"";
|
||||
break;
|
||||
case "V": //Vista
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
function dameCheckboxAutoVistas($tipo){
|
||||
$result="";
|
||||
switch ($tipo) {
|
||||
case "A": //agente
|
||||
$result=" + \"<BR><input type=\'checkbox\' id=vista_MG name=\'vista_MG\' value=\'vista_MG\'> <label for=vista_MG>Crear vista con grupos de modulos </label> \"";
|
||||
$result.=" + \"<BR><input type=\'checkbox\' id=vista_M name=\'vista_M\' value=\'vista_M\'> <label for=vista_M>Crear vista con modulos </label><br> \"";
|
||||
break;
|
||||
case "GA": //Grupo Agentes
|
||||
$result=" + \"<BR><input type=\'checkbox\' id=vista_A name=\'vista_A\' value=\'vista_A\'> <label for=vista_A>Crear vista con agentes </label><br> \"";
|
||||
$result.=" + \"<BR><input type=\'checkbox\' id=vista_MG name=\'vista_MG\' value=\'vista_MG\'> <label for=vista_MG>Crear vista con grupos de modulos </label> \"";
|
||||
$result.=" + \"<BR><input type=\'checkbox\' id=vista_M name=\'vista_M\' value=\'vista_M\'> <label for=vista_M>Crear vista con modulos </label><br> \"";
|
||||
break;
|
||||
case "M": //Modulo
|
||||
break;
|
||||
case "GM": //Grupo Modulos
|
||||
$result=" + \"<BR><input type=\'checkbox\' id=vista_M name=\'vista_M\' value=\'vista_M\'> <label for=vista_M>Crear vista con modulos </label><br> \"";
|
||||
break;
|
||||
case "V": //Vista
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// function representaEnCaja($datos)
|
||||
// {
|
||||
// $resultado="";
|
||||
//
|
||||
// $resultado = "+ \"<select name='nom_imagen' >\"";
|
||||
// for ($i=0;$i < size($datos);$i++)
|
||||
// {
|
||||
// $resultado .= "+ \"<option value='".$datos[$i]."'>".$datos[$i]."</option> \"";
|
||||
// }
|
||||
//
|
||||
// $resultado .= "+ \"</select>\"
|
||||
// + \"<BR>\"";
|
||||
//
|
||||
// return $resultado;
|
||||
// }
|
||||
//
|
||||
|
||||
function mensaje($msj)
|
||||
{
|
||||
echo "alert('".$msj."');";
|
||||
function mensaje($msj){
|
||||
echo "alert('".$msj."');";
|
||||
}
|
||||
|
||||
|
||||
// Funcion que devuelve la imagen de la gráfica que lo representa
|
||||
function dameGrafica($idModulo)
|
||||
{
|
||||
function dameGrafica($idModulo){
|
||||
global $graphURL;
|
||||
$origin = time() -3600;
|
||||
return "$graphURL?tipo=sparse&id=$idModulo&color=40d840&periodo=60&intervalo=12&label=Hourly%20graph&tipo=sparse&id=$idModulo&refresh=30&zoom=100&draw_events=1&origin=$origin";
|
||||
|
|
|
@ -1,270 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Pandora - the Free monitoring system
|
||||
// ====================================
|
||||
//
|
||||
// report_matrix.php
|
||||
//
|
||||
// This file is Copyright (c) 2007 Leandro Doctors, ldoctors@gusila.org.ar.
|
||||
//
|
||||
// This file contains code from exportdata.php, which is
|
||||
// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
|
||||
// Copyright (c) 2005-2006 Artica Soluciones Tecnologicas S.L, info@artica.es
|
||||
// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
/********** Some necesary functions ********************/
|
||||
|
||||
function dame_promedio_de_un_modulo_de_un_agente_para_una_hora_det_de_un_dia_de_la_semana ($id_de_mi_agente, $mod_de_mi_agente, $hora_det, $dia_de_la_semana)
|
||||
// Genera el contenido de c/u de las celdas de datos de la matriz de promedios. Válida sólo para módulos no-string
|
||||
{
|
||||
require ("include/config.php");
|
||||
$query1="SELECT AVG(datos)
|
||||
FROM tagente_datos
|
||||
WHERE id_agente=".$id_de_mi_agente."
|
||||
AND HOUR(timestamp)=".$hora_det."
|
||||
AND WEEKDAY(timpestamp)=".$dia_de_la_semana."
|
||||
AND 'timestamp' >=".$fecha_inicio."
|
||||
AND 'timestamp' <=".$fecha_fin;
|
||||
$resq1=mysql_query($query1);
|
||||
return($resq1);
|
||||
}
|
||||
|
||||
function generar_tabla_de_promedios_de_datos_no_string ($id_de_mi_agente, $id_de_mi_mod,$fecha_inicio,$fecha_fin)
|
||||
// Genera una tabla con los promedios de los datos de un módulo no-string
|
||||
{
|
||||
$dias_de_la_semana=array ("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
|
||||
$nombre_modulo=dame_nombre_modulo_agentemodulo($id_de_mi_mod);
|
||||
echo "<br>Módulo: ".$nombre_modulo."<br>";
|
||||
|
||||
// Encabezado de la tabla
|
||||
echo "<TABLE BORDER=1>
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TH ROWSPAN=\"2\">Hora</TH>
|
||||
<TH COLSPAN=\"7\">Día</TH>
|
||||
</TR>
|
||||
<TR>";
|
||||
for ($dia=0;$dia<7;++$dia)
|
||||
echo "
|
||||
<TH>".$dias_de_la_semana[$dia]."</TH>";
|
||||
echo
|
||||
"</TR>";
|
||||
|
||||
for ($hora=0;$hora<24;++$hora)
|
||||
{
|
||||
echo"
|
||||
<TR>
|
||||
<TH>".$hora." h.</TH>";
|
||||
for ($dia=1;$dia<8;++$dia)
|
||||
echo "<TD>".dame_promedio_de_un_modulo_no_string_de_un_agente_para_una_hora_det_de_un_dia_de_la_semana_en_un_rango_de_fechas_det($id_de_mi_agente, $id_de_mi_mod, $hora, $dia, $fecha_inicio, $fecha_fin)."</TD>";
|
||||
echo
|
||||
"</TR>";
|
||||
}
|
||||
echo "</TBODY></TABLE>";
|
||||
}
|
||||
|
||||
|
||||
/************** Main program *******************************/
|
||||
|
||||
|
||||
// Load global vars
|
||||
require("include/config.php");
|
||||
|
||||
if (comprueba_login() != 0) {
|
||||
echo "NO PERM";
|
||||
exit;
|
||||
}
|
||||
|
||||
$id_user = $_SESSION["id_usuario"];
|
||||
if ( (give_acl($id_user, 0, "AR")==0) AND (give_acl($id_user, 0, "AW")==0) ){
|
||||
echo "NO PERM";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ((isset($_GET["operacion"])) AND (! isset($_POST["update_agent"]))){
|
||||
if (isset ($_POST["copiar"])){
|
||||
// Option A: Print exported data
|
||||
// Export main button
|
||||
echo "<h2>".$lang_label["ag_title"]."</h2>";
|
||||
|
||||
// echo "<h3>".$lang_label["export_title"]."<a href='help/".$help_code."/chap3.php#336' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
||||
|
||||
if (isset ($_POST["origen_modulo"])){
|
||||
$origen = $_POST["origen"];
|
||||
|
||||
/* Comentado sólo para propósitos de prueba (Si no, no anda)
|
||||
if (give_acl($id_user,dame_id_grupo($origen),"AR")!=1)
|
||||
{
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Export Data");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
*/
|
||||
|
||||
$origen_modulo = $_POST["origen_modulo"];
|
||||
$from_date =$_POST["from_date"];
|
||||
$to_date=$_POST["to_date"];
|
||||
|
||||
// Imprime encabezado
|
||||
echo $lang_label["db_agent_bra"]."<b>".dame_nombre_agente($origen)."</b>".$lang_label["from2"]."<b>".$from_date."</b>".$lang_label["to2"]."<b>".$to_date."</b><br>";
|
||||
|
||||
// Esto podría reutilizarse
|
||||
echo "<br><table cellpadding='3' cellspacing='3' width='600'><tr><th class='datos'>".$lang_label["module"]."</th><th class=datos>".$lang_label["data"]."<th class='datos'>Timestamp</th>";
|
||||
|
||||
|
||||
// For each module
|
||||
for ($a=0;$a <count($origen_modulo); $a++){
|
||||
$id_modulo = $origen_modulo[$a];
|
||||
$tipo = dame_nombre_tipo_modulo(dame_id_tipo_modulo_agentemodulo($id_modulo));
|
||||
|
||||
if ($tipo != "generic_data_string")
|
||||
echo "<br>". generar_tabla_de_promedios_de_datos_no_string ($origen,$id_modulo,$from_date,$to_date);
|
||||
}
|
||||
}
|
||||
} // End Option A
|
||||
} else {
|
||||
// Option B: Print Form
|
||||
// Form view
|
||||
?>
|
||||
<h2><?php echo $lang_label["ag_title"] ?></h2>
|
||||
<h3><?php echo $lang_label["export_data"] ?><a href='help/<?php echo $help_code; ?>/chap3.php#336' target='_help' class='help'> <span><?php echo $lang_label["help"] ?></span></a></h3>
|
||||
<form method="post" action="index.php?sec=estado&sec2=operation/agentes/exportdata&operacion=1" name="export_form">
|
||||
<table width=550 border=0 cellspacing=3 cellpadding=5 class=fon>
|
||||
<tr>
|
||||
<td class='datost'><b><?php echo $lang_label["source_agent"] ?> </b><br><br>
|
||||
|
||||
<select name="origen" class="w130">
|
||||
<?php
|
||||
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
|
||||
echo "<option value=".$_POST["origen"].">".dame_nombre_agente($_POST["origen"]);
|
||||
}
|
||||
// Show combo with agents
|
||||
$sql1='SELECT * FROM tagente';
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ){
|
||||
if (give_acl($id_user, $row["id_grupo"], "AR")==1)
|
||||
if ( $_POST["origen"] != $row["id_agente"])
|
||||
echo "<option value=".$row["id_agente"].">".$row["nombre"];
|
||||
}
|
||||
else
|
||||
if (give_acl($id_user, $row["id_grupo"], "AR")==1)
|
||||
echo "<option value=".$row["id_agente"].">".$row["nombre"];
|
||||
}
|
||||
echo "</select> <input type=submit name='update_agent' class=sub value='".$lang_label["get_info"]."'><br><br>";
|
||||
|
||||
echo "<b>".$lang_label["modules"]."</b><br><br>";
|
||||
echo "<select name='origen_modulo[]' size=8 class='w130'>";
|
||||
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
|
||||
// Populate Module/Agent combo
|
||||
$agente_modulo = $_POST["origen"];
|
||||
$sql1="SELECT * FROM tagente_modulo WHERE id_agente = ".$agente_modulo;
|
||||
$result = mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if (give_acl($id_user, $row["id_grupo"], "AR")==1)
|
||||
echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"];
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td class='datos2t'><b><?php echo $lang_label["date_range"]; ?></b><br><br>
|
||||
<table cellspacing=3 cellpadding=3 border=0>
|
||||
<?php
|
||||
$mh = "10080"; // a week, una semana
|
||||
$m_year = date("Y", time()-$mh*60);
|
||||
$m_month = date("m", time()-$mh*60);
|
||||
$m_day = date("d", time()-$mh*60);
|
||||
$m_hour = date("H", time()-$mh*60);
|
||||
$m_min = date("i", time()-$mh*60);
|
||||
$m = $m_year."-".$m_month."-".$m_day." ".$m_hour.":".$m_min.":"."00"; //one week ago
|
||||
$ahora = date("Y-m-d H:i:s"); //Now
|
||||
|
||||
require ("include/calendar.php"); //Including calendar
|
||||
$result=mysql_query("SELECT token, value FROM tconfig");
|
||||
$row=mysql_fetch_array($result);
|
||||
if ($row["token"]=="language_code") $locale=$row["value"]; //language of calendar.
|
||||
|
||||
$time = time();
|
||||
|
||||
if (isset($_GET["month"])) $month = $_GET["month"];
|
||||
else $month = date('n', $time);
|
||||
if (isset($_GET["year"])) $year = $_GET["year"];
|
||||
else $year = date('Y', $time);
|
||||
|
||||
//preparate months (the next month to december is january and back)
|
||||
$first_of_month = gmmktime(0,0,0,$month,1,$year);
|
||||
list($month, $year) = explode(',',gmstrftime('%m,%Y',$first_of_month));
|
||||
$month_a = ($month-1);
|
||||
$month_d = ($month+1);
|
||||
if ($month_d==13) {$year_d = $year; $year_a = $year;}
|
||||
else {
|
||||
if ($month==12) $year_d = $year+1;
|
||||
else $year_d = $year;
|
||||
if ($month==0) $year_a = $year-1;
|
||||
else $year_a = $year;
|
||||
}
|
||||
|
||||
if (isset($_GET["date_from"])) $date_from=$_GET["date_from"];
|
||||
else
|
||||
{if (isset($_POST["from_date"])) $date_from=$_POST["from_date"];
|
||||
else $date_from=$m;
|
||||
}
|
||||
|
||||
if (isset($_GET["date_to"])) $date_to=$_GET["date_to"];
|
||||
else
|
||||
{if (isset($_POST["to_date"])) $date_to=$_POST["to_date"];
|
||||
else $date_to=$ahora;
|
||||
}
|
||||
|
||||
$days_f = array();
|
||||
$days_t = array();
|
||||
$days_in_month=gmdate('t',$first_of_month);
|
||||
//create links for days in every calendar:
|
||||
for ($day_f=1; $day_f<=$days_in_month; $day_f++){
|
||||
$days_f[$day_f]=array('index.php?sec=estado&sec2=operation/agentes/exportdata&date_from='.$year.'-'.$month.'-'.date('d',mktime(0, 0, 0, $month, $day_f, $year)).' 00:00:00&date_to='.$date_to.'&year='.$year.'&month='.$month);
|
||||
}
|
||||
for ($day_t=1; $day_t<=$days_in_month; $day_t++){
|
||||
$days_t[$day_t]=array('index.php?sec=estado&sec2=operation/agentes/exportdata&date_from='.$date_from.'&date_to='.$year.'-'.$month.'-'.date('d',mktime(0, 0, 0, $month, $day_t, $year)).' 00:00:00'.'&year='.$year.'&month='.$month);
|
||||
}
|
||||
if (isset($date_from) && isset($date_to))
|
||||
{$date="&date_from=".$date_from."&date_to=".$date_to;}
|
||||
echo "<tr><td class='datost'>".$lang_label["from"]." <input type=\"text\" class=\"sub\" name=\"from_date\" value=\"".$date_from." size=\"21\"><br><br>";
|
||||
|
||||
//print calendar and links for next and previous months
|
||||
echo "
|
||||
<table><tr>
|
||||
<td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=\"".$month_a."&year=".$year_a.$date."'><font size =+1>«</font></a></td>
|
||||
<td>".generate_calendar($year, $month, $days_f, 3, NULL, $locale)."</td><td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=".$month_d."&year=".$year_d.$date."'><font size =+1>»</font></a></td>
|
||||
</tr></table>
|
||||
|
||||
<tr><td class='datost'><br>".$lang_label["to"]." <input type=\"text\" class=\"sub\" name=\"to_date\" value=\"".$date_to."\" size=\"21\"><br><br>";
|
||||
|
||||
//print calendar and links for next and previous months
|
||||
echo "
|
||||
<table><tr>
|
||||
<td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=".$month_a."&year=".$year_a.$date."'><font size =+1>«</font></a></td>
|
||||
<td>".generate_calendar($year, $month, $days_t, 3, NULL, $locale)."</td><td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=".$month_d."&year=".$year_d.$date."'><font size =+1>»</font></a></td>
|
||||
</tr></table>
|
||||
|
||||
<tr><td></td></tr>
|
||||
<tr><td colspan=2 class=\"datos2b\" align=\"right\">
|
||||
<input type=submit name=\"copiar\" class=sub value=".$lang_label["export"].">
|
||||
</table></td></tr>
|
||||
</table>";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Main PHP/SQL code development and project architecture and management
|
||||
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// CSS and some PHP code additions
|
||||
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
|
||||
// Javascript Active Console code.
|
||||
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
|
||||
// Additions to code for Pandora FMS 1.2 graph code and new XML reporting template managemement
|
||||
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
include ("../../include/config.php");
|
||||
include ("../../include/functions.php");
|
||||
include ("../../include/functions_db.php");
|
||||
|
||||
session_start();
|
||||
|
||||
$id_user = $_SESSION["id_usuario"];
|
||||
if ( (give_acl($id_user, 0, "AR")==0) AND (give_acl($id_user, 0, "AW")==0) ){
|
||||
require ("../../general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( isset ($_GET["agentmodule"]) && isset ($_GET["agent"]) ){
|
||||
$id_agentmodule = $_GET["agentmodule"];
|
||||
$id_agent = $_GET["agent"];
|
||||
$agentmodule_name = dame_nombre_modulo_agentemodulo($id_agentmodule);
|
||||
if (give_acl($id_user,dame_id_grupo($id_agent),"AR")!=1) {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Export Data");
|
||||
require ("../../general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$now = date("Y/m/d H:i:s");
|
||||
|
||||
// Show contentype header
|
||||
Header("Content-type: text/txt");
|
||||
header('Content-Disposition: attachment; filename="pandora_export_'.$agentmodule_name.'.txt"');
|
||||
|
||||
if (isset($_GET["from_date"]))
|
||||
$from_date = $_GET["from_date"];
|
||||
else
|
||||
$from_date = $now;
|
||||
|
||||
if (isset($_GET["to_date"]))
|
||||
$to_date = $_GET["to_date"];
|
||||
else
|
||||
$to_date = $now;
|
||||
|
||||
// Make the query
|
||||
$sql1="SELECT * FROM tdatos WHERE id_agente = $id_agent AND id_agente_modulo = $id_agentmodule";
|
||||
$tipo = dame_nombre_tipo_modulo(dame_id_tipo_modulo_agentemodulo($id_agentmodule));
|
||||
if ($tipo == "generic_data_string")
|
||||
$sql1='SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC';
|
||||
else
|
||||
$sql1='SELECT * FROM tagente_datos WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC';
|
||||
$result1=mysql_query($sql1);
|
||||
|
||||
// Render data
|
||||
while ($row=mysql_fetch_array($result1)){
|
||||
echo $agentmodule_name;
|
||||
echo ",";
|
||||
echo $row["datos"];
|
||||
echo ",";
|
||||
echo $row["timestamp"];
|
||||
echo chr(13);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,10 +1,17 @@
|
|||
<?php
|
||||
|
||||
|
||||
// Pandora FMS - the Free monitoring system
|
||||
// ========================================
|
||||
// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
|
||||
// Main PHP/SQL code development and project architecture and management
|
||||
// Copyright (c) 2007 Leandro Doctors, ldoctors@gusila.org.ar
|
||||
// For code belongs to average_per_hourday matrix report code
|
||||
// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
|
||||
// CSS and some PHP code additions
|
||||
// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
|
||||
// Javascript Active Console code.
|
||||
// Copyright (c) 2006 Jose Navarro <contacto@indiseg.net>
|
||||
// Additions to code for Pandora FMS 1.2 graph code and new XML reporting template managemement
|
||||
// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas, info@artica.es
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
|
@ -18,90 +25,234 @@
|
|||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
|
||||
function give_average_from_module ($id_agente, $id_agente_modulo, $hour, $day, $start_date, $end_date){
|
||||
// Return average value from an agentmodule, for a specific hour of specific day of week,
|
||||
// Only valid for non-string kind of data.
|
||||
require ("include/config.php");
|
||||
$query1 = "SELECT AVG(datos)
|
||||
FROM tagente_datos
|
||||
WHERE id_agente_modulo = ". $id_agente_modulo."
|
||||
AND HOUR(timestamp) = ".$hour."
|
||||
AND WEEKDAY(timestamp) = ".$day."
|
||||
AND timestamp >= '$start_date'
|
||||
AND timestamp <= '$end_date'";
|
||||
|
||||
if (($resq1 = mysql_query($query1)) AND ($row=mysql_fetch_array($resq1)))
|
||||
return $row[0];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
function generate_average_table ($id_de_mi_agente, $id_agente_modulo, $fecha_inicio, $fecha_fin){
|
||||
// Genera una tabla con los promedios de los datos de un módulo no-string
|
||||
require ("include/config.php");
|
||||
require ("include/languages/language_".$language_code.".php");
|
||||
$dias_de_la_semana = array ($lang_label["sunday"],$lang_label["monday"],$lang_label["tuesday"],$lang_label["wednesday"],$lang_label["thurdsday"],$lang_label["friday"],$lang_label["saturday"]);
|
||||
$nombre_modulo = dame_nombre_modulo_agentemodulo($id_agente_modulo);
|
||||
|
||||
// Table header
|
||||
echo "<table border=0 cellpadding=4 cellspacing=4 width=600 class='databox'>";
|
||||
echo "<tbody><TR><TH ROWSPAN=\"2\">".$lang_label["hour"]."</TH>";
|
||||
echo "<TH COLSPAN=\"7\">".$lang_label["day"]."</TH></TR>";
|
||||
echo "<TR>";
|
||||
for ($dia=0;$dia<7;++$dia)
|
||||
echo "<th>".$dias_de_la_semana[$dia]."</th>";
|
||||
echo "</tr>";
|
||||
$color = 0;
|
||||
for ($hora=0;$hora<24;++$hora){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
} else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr><th class='datos3'> $hora ".$lang_label["hr"]."</th>";
|
||||
for ($dia=0; $dia<7; ++$dia){
|
||||
echo "<td class='$tdcolor'>";
|
||||
echo format_numeric (give_average_from_module ($id_de_mi_agente, $id_agente_modulo, $hora, $dia, $fecha_inicio, $fecha_fin));
|
||||
echo "</td >";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</tbody></table>";
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
// Main code
|
||||
// ----------------------------------
|
||||
|
||||
// Load global vars
|
||||
require("include/config.php");
|
||||
|
||||
$id_user = "";
|
||||
if (comprueba_login() == 0)
|
||||
$id_user = $_SESSION["id_usuario"];
|
||||
if (give_acl($id_user, 0, "AR")!=1) {
|
||||
audit_db ($id_user, $REMOTE_ADDR, "ACL Violation",
|
||||
"Trying to access Agent Data Export view (Grouped)");
|
||||
// Security checks
|
||||
if (comprueba_login() != 0) {
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$id_user = $_SESSION["id_usuario"];
|
||||
if ( (give_acl($id_user, 0, "AR")==0) AND (give_acl($id_user, 0, "AW")==0) ){
|
||||
require ("general/noaccess.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ((isset($_POST["export"])) AND (! isset($_POST["update_agent"]))){
|
||||
|
||||
if (isset($_POST["export_type"]))
|
||||
$export_type = $_POST["export_type"];
|
||||
else
|
||||
$export_type = 3; // Standard table;
|
||||
|
||||
if ($export_type == 1) { // CSV
|
||||
echo "<h3>".$lang_label["export_title"]."<a href='help/".$help_code."/chap3.php#336' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
||||
|
||||
if (isset ($_POST["origen_modulo"])){
|
||||
$origen = $_POST["origen"];
|
||||
if (give_acl($id_user, dame_id_grupo($origen), "AR")!=1) {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Export Data");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
$origen_modulo = $_POST["origen_modulo"];
|
||||
$id_agentemodulo = $origen_modulo[0];
|
||||
$start_date =$_POST["start_date"];
|
||||
$end_date=$_POST["end_date"];
|
||||
$start_time =$_POST["start_time"];
|
||||
$end_time=$_POST["end_time"];
|
||||
$from_date = $start_date." ".$start_time;
|
||||
$to_date = $end_date." ".$end_time;
|
||||
|
||||
$agentmodule_name = dame_nombre_modulo_agentemodulo($origen_modulo[0]);
|
||||
echo $lang_label["db_agent_bra"]. "<b>" . dame_nombre_agente($origen). "- $agentmodule_name</b>". $lang_label["from2"]. "<b>". $from_date. "</b>". $lang_label["to2"]. "<b>". $to_date. "</b><br>";
|
||||
|
||||
echo "<a href='operation/agentes/export_csv.php?from_date=$from_date&to_date=$to_date&agent=$origen&agentmodule=$id_agentemodulo'><img src='images/disk.png'> ".$lang_label["get_file"]."</a> pandora_export_$agentmodule_name.txt";
|
||||
} else
|
||||
echo "<b class='error'>".$lang_label["no_sel_mod"]."</b>";
|
||||
}
|
||||
|
||||
if ($export_type == 2){ // Avarage day/hour matrix
|
||||
if (isset ($_POST["origen_modulo"])){
|
||||
$origen = $_POST["origen"];
|
||||
$origen_modulo = $_POST["origen_modulo"];
|
||||
$start_date =$_POST["start_date"];
|
||||
$end_date=$_POST["end_date"];
|
||||
$start_time =$_POST["start_time"];
|
||||
$end_time=$_POST["end_time"];
|
||||
|
||||
$agentmodule_name = dame_nombre_modulo_agentemodulo($origen_modulo[0]);
|
||||
$from_date = $start_date." ".$start_time;
|
||||
$to_date = $end_date." ".$end_time;
|
||||
|
||||
// Header
|
||||
echo "<h3>".$lang_label["export_title"]."<a href='help/".$help_code."/chap3.php#336' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
||||
echo $lang_label["db_agent_bra"]. "<b>" . dame_nombre_agente($origen). "- $agentmodule_name</b>". $lang_label["from2"]. "<b>". $from_date. "</b>". $lang_label["to2"]. "<b>". $to_date. "</b><br>";
|
||||
echo "<br>";
|
||||
|
||||
// For each module
|
||||
for ($a=0;$a <count($origen_modulo); $a++){
|
||||
$id_modulo = $origen_modulo[$a];
|
||||
$tipo = dame_nombre_tipo_modulo(dame_id_tipo_modulo_agentemodulo($id_modulo));
|
||||
|
||||
if ($tipo != "generic_data_string")
|
||||
echo "<br>". generate_average_table ($origen,$id_modulo,$from_date,$to_date);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((isset($_GET["operacion"])) AND (! isset($_POST["update_agent"]))){
|
||||
if (isset ($_POST["copiar"])){ // Export main button
|
||||
echo "<h2>".$lang_label["ag_title"]."</h2>";
|
||||
if ($export_type == 3) { // Standard table
|
||||
echo "<h3>".$lang_label["export_title"]."<a href='help/".$help_code."/chap3.php#336' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
||||
if (isset ($_POST["origen_modulo"])){
|
||||
if (isset ($_POST["csv"])) // CSV version
|
||||
$csv = 1;
|
||||
else
|
||||
$csv = 0;
|
||||
$origen = $_POST["origen"];
|
||||
if (give_acl($id_user,dame_id_grupo($origen),"AR")!=1) {
|
||||
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access Agent Export Data");
|
||||
require ("general/noaccess.php");
|
||||
}
|
||||
$origen_modulo = $_POST["origen_modulo"];
|
||||
$from_date =$_POST["from_date"];
|
||||
$to_date=$_POST["to_date"];
|
||||
echo $lang_label["db_agent_bra"]."<b>".dame_nombre_agente($origen)."</b>".$lang_label["from2"]."<b>".$from_date."</b>".$lang_label["to2"]."<b>".$to_date."</b><br>";
|
||||
if ($csv == 0){
|
||||
echo "<br><table cellpadding='3' cellspacing='3' width='600'><tr><th class='datos'>".$lang_label["module"]."</th><th class=datos>".$lang_label["data"]."<th class='datos'>Timestamp</th>";
|
||||
$separador_1 = "<tr><td class='datos_id'>";
|
||||
$separador_2 = "<td class='datos'>";
|
||||
$separador_3= "";
|
||||
} else {
|
||||
$separador_1 = "<br>'";
|
||||
$separador_2 = "','";
|
||||
$separador_3 = "'";
|
||||
}
|
||||
$agentmodule_name = dame_nombre_modulo_agentemodulo($origen_modulo[0]);
|
||||
$start_date =$_POST["start_date"];
|
||||
$end_date=$_POST["end_date"];
|
||||
$start_time =$_POST["start_time"];
|
||||
$end_time=$_POST["end_time"];
|
||||
|
||||
$from_date = $start_date." ".$start_time;
|
||||
$to_date = $end_date." ".$end_time;
|
||||
|
||||
for ($a=0;$a <count($origen_modulo); $a++){ // For each module
|
||||
echo $lang_label["db_agent_bra"]. "<b>" . dame_nombre_agente($origen). "- $agentmodule_name</b>". $lang_label["from2"]. "<b>". $from_date. "</b>". $lang_label["to2"]. "<b>". $to_date. "</b><br>";
|
||||
|
||||
echo "<br><table cellpadding='4' cellspacing='4' width='600' class='databox'>";
|
||||
echo "<tr><th class='datos'>".$lang_label["module"]."</th><th class=datos>".$lang_label["data"]."<th class='datos'>Timestamp</th>";
|
||||
|
||||
// Begin the render !
|
||||
for ($a=0; $a <count($origen_modulo); $a++){ // For each module (not used multiple modules yet!)
|
||||
$id_modulo = $origen_modulo[$a];
|
||||
$sql1='SELECT * FROM tdatos WHERE id_agente = '.$origen;
|
||||
$tipo = dame_nombre_tipo_modulo(dame_id_tipo_modulo_agentemodulo($id_modulo));
|
||||
if ($tipo == "generic_data_string")
|
||||
$sql1='SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC';
|
||||
$sql1 = 'SELECT * FROM tagente_datos_string WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC';
|
||||
else
|
||||
$sql1='SELECT * FROM tagente_datos WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC';
|
||||
$result1=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result1)){
|
||||
echo $separador_1;
|
||||
echo dame_nombre_modulo_agentemodulo($id_modulo);
|
||||
echo $separador_2;
|
||||
$sql1 = 'SELECT * FROM tagente_datos WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_modulo.' ORDER BY timestamp DESC';
|
||||
$result1 = mysql_query ($sql1);
|
||||
$color=1;
|
||||
while ($row = mysql_fetch_array ($result1)){
|
||||
if ($color == 1){
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
} else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<tr><td class='$tdcolor'>";
|
||||
echo $agentmodule_name;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $row["datos"];
|
||||
echo $separador_2;
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
echo $row["timestamp"];
|
||||
echo $separador_3;
|
||||
echo "</td></tr>";
|
||||
}
|
||||
}
|
||||
if ($csv == 0) {
|
||||
echo "<tr><td colspan='3'><div class='raya'></div></td></tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
} else
|
||||
echo "<b class='error'>".$lang_label["no_sel_mod"]."</b>";
|
||||
}
|
||||
} else { // Form view
|
||||
?>
|
||||
<h2><?php echo $lang_label["ag_title"] ?></h2>
|
||||
<h3><?php echo $lang_label["export_data"] ?><a href='help/<?php echo $help_code; ?>/chap3.php#336' target='_help' class='help'> <span><?php echo $lang_label["help"] ?></span></a></h3>
|
||||
<form method="post" action="index.php?sec=estado&sec2=operation/agentes/exportdata&operacion=1" name="export_form">
|
||||
<table width=550 border=0 cellspacing=3 cellpadding=5 class=fon>
|
||||
<tr>
|
||||
<td class='datost'><b><?php echo $lang_label["source_agent"] ?> </b><br><br>
|
||||
|
||||
<select name="origen" class="w130">
|
||||
<?php
|
||||
}
|
||||
|
||||
} else {
|
||||
// Option B: Print Form
|
||||
// Form view
|
||||
$ahora=date("Y/m/d H:i:s");
|
||||
if (isset($_GET["date_from"]))
|
||||
$date_from=$_GET["date_from"];
|
||||
else
|
||||
if (isset($_POST["from_date"]))
|
||||
$date_from = $_POST["from_date"];
|
||||
else
|
||||
$date_from = $ahora;
|
||||
|
||||
if (isset($_GET["date_to"]))
|
||||
$date_to = $_GET["date_to"];
|
||||
else
|
||||
if (isset($_POST["to_date"]))
|
||||
$date_to = $_POST["to_date"];
|
||||
else
|
||||
$date_to = $ahora;
|
||||
|
||||
|
||||
echo "<h2>".$lang_label["ag_title"]."</h2>";
|
||||
echo "<h3>".$lang_label["export_data"]."<a href='help/$help_code/chap3.php#336' target='_help' class='help'> <span>".$lang_label["help"]."</span></a></h3>";
|
||||
|
||||
echo '<form method="post" action="index.php?sec=estado&sec2=operation/agentes/exportdata" name="export_form">';
|
||||
echo '<table width=550 border=0 cellspacing=3 cellpadding=5 class=databox>';
|
||||
echo '<tr>';
|
||||
echo "<td class='datos'><b>".$lang_label["source_agent"]."</b><br><br>";
|
||||
echo "<td class='datos'>";
|
||||
|
||||
|
||||
// Show combo with agents
|
||||
echo '<select name="origen" class="w130">';
|
||||
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
|
||||
echo "<option value=".$_POST["origen"].">".dame_nombre_agente($_POST["origen"]);
|
||||
}
|
||||
// Show combo with agents
|
||||
$sql1='SELECT * FROM tagente';
|
||||
$result=mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
|
@ -114,111 +265,61 @@ if ((isset($_GET["operacion"])) AND (! isset($_POST["update_agent"]))){
|
|||
if (give_acl($id_user, $row["id_grupo"], "AR")==1)
|
||||
echo "<option value=".$row["id_agente"].">".$row["nombre"];
|
||||
}
|
||||
echo "</select> <input type=submit name='update_agent' class=sub value='".$lang_label["get_info"]."'><br><br>";
|
||||
echo "</select> ";
|
||||
echo "<input type=submit name='update_agent' class='sub next' value='".$lang_label["get_info"]."'><br><br>";
|
||||
|
||||
|
||||
echo '<tr>';
|
||||
echo "<td class='datos2'>";
|
||||
echo "<b>".$lang_label["modules"]."</b><br><br>";
|
||||
echo "<select name='origen_modulo[]' size=8 multiple=yes class='w130'>";
|
||||
echo "<td class='datos2'>";
|
||||
|
||||
// Combo with modules
|
||||
echo "<select name='origen_modulo[]' size=8 class='w130'>";
|
||||
if ( (isset($_POST["update_agent"])) AND (isset($_POST["origen"])) ) {
|
||||
// Populate Module/Agent combo
|
||||
$agente_modulo = $_POST["origen"];
|
||||
$sql1="SELECT * FROM tagente_modulo WHERE id_agente = ".$agente_modulo;
|
||||
$result = mysql_query($sql1);
|
||||
while ($row=mysql_fetch_array($result)){
|
||||
if (give_acl($id_user, $row["id_grupo"], "AR")==1)
|
||||
echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"];
|
||||
echo "<option value=".$row["id_agente_modulo"].">".$row["nombre"];
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td class='datos2t'><b><?php echo $lang_label["date_range"]; ?></b><br><br>
|
||||
<table cellspacing=3 cellpadding=3 border=0>
|
||||
<?php
|
||||
$mh = "10080"; // a week, una semana
|
||||
$m_year = date("Y", time()-$mh*60);
|
||||
$m_month = date("m", time()-$mh*60);
|
||||
$m_day = date("d", time()-$mh*60);
|
||||
$m_hour = date("H", time()-$mh*60);
|
||||
$m_min = date("i", time()-$mh*60);
|
||||
$m = $m_year."-".$m_month."-".$m_day." ".$m_hour.":".$m_min.":"."00"; //one week ago
|
||||
$ahora = date("Y-m-d H:i:s"); //Now
|
||||
|
||||
|
||||
echo "<tr><td class='datos'>";
|
||||
echo "<b>".$lang_label["begin_date"]."</b>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<input type='text' id='start_date' name='start_date' size=10 value='".substr($date_from,0,10)."'> <img src='images/calendar_view_day.png' onclick='scwShow(scwID(\"start_date\"),this);'> ";
|
||||
echo "<input type='text' name='start_time' size=10 value='".substr($date_from,11,8)."'>";
|
||||
|
||||
|
||||
require ("include/calendar.php"); //Including calendar
|
||||
$result=mysql_query("SELECT token, value FROM tconfig");
|
||||
$row=mysql_fetch_array($result);
|
||||
if ($row["token"]=="language_code") $locale=$row["value"]; //language of calendar.
|
||||
echo "<tr><td class='datos2'>";
|
||||
echo "<b>".$lang_label["end_date"]."</b>";
|
||||
|
||||
echo "<td class='datos2'>";
|
||||
echo "<input type='text' id='end_date' name='end_date' size=10 value='".substr($date_to,0,10)."'> <img src='images/calendar_view_day.png' onclick='scwShow(scwID(\"end_date\"),this);'> ";
|
||||
echo "<input type='text' name='end_time' size=10 value='".substr($date_to,11,8)."'>";
|
||||
|
||||
$time = time();
|
||||
echo "<tr><td class='datos'>";
|
||||
echo "<b>".$lang_label["export_type"]."</b>";
|
||||
echo "<td class='datos'>";
|
||||
// Combo for data export type
|
||||
echo "<select name='export_type'>";
|
||||
echo "<option value=3>".$lang_label["datatable"];
|
||||
echo "<option value=1>".$lang_label["csv"];
|
||||
echo "<option value=2>".$lang_label["average_per_hourday"];
|
||||
echo "</select>";
|
||||
echo "</table>";
|
||||
// Submit button
|
||||
|
||||
if (isset($_GET["month"])) $month = $_GET["month"];
|
||||
else $month = date('n', $time);
|
||||
if (isset($_GET["year"])) $year = $_GET["year"];
|
||||
else $year = date('Y', $time);
|
||||
echo ' ';
|
||||
echo "<table width=570>";
|
||||
echo "<tr><td align='right'>";
|
||||
echo "<input type=submit name='export' class='sub wand' value=".$lang_label["export"].">";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
//preparate months (the next month to december is january and back)
|
||||
$first_of_month = gmmktime(0,0,0,$month,1,$year);
|
||||
list($month, $year) = explode(',',gmstrftime('%m,%Y',$first_of_month));
|
||||
$month_a = ($month-1);
|
||||
$month_d = ($month+1);
|
||||
if ($month_d==13) {$year_d = $year; $year_a = $year;}
|
||||
else {
|
||||
if ($month==12) $year_d = $year+1;
|
||||
else $year_d = $year;
|
||||
if ($month==0) $year_a = $year-1;
|
||||
else $year_a = $year;
|
||||
}
|
||||
|
||||
if (isset($_GET["date_from"])) $date_from=$_GET["date_from"];
|
||||
else
|
||||
{if (isset($_POST["from_date"])) $date_from=$_POST["from_date"];
|
||||
else $date_from=$m;
|
||||
}
|
||||
|
||||
if (isset($_GET["date_to"])) $date_to=$_GET["date_to"];
|
||||
else
|
||||
{if (isset($_POST["to_date"])) $date_to=$_POST["to_date"];
|
||||
else $date_to=$ahora;
|
||||
}
|
||||
|
||||
$days_f = array();
|
||||
$days_t = array();
|
||||
$days_in_month=gmdate('t',$first_of_month);
|
||||
//create links for days in every calendar:
|
||||
for ($day_f=1; $day_f<=$days_in_month; $day_f++){
|
||||
$days_f[$day_f]=array('index.php?sec=estado&sec2=operation/agentes/exportdata&date_from='.$year.'-'.$month.'-'.date('d',mktime(0, 0, 0, $month, $day_f, $year)).' 00:00:00&date_to='.$date_to.'&year='.$year.'&month='.$month);
|
||||
}
|
||||
for ($day_t=1; $day_t<=$days_in_month; $day_t++){
|
||||
$days_t[$day_t]=array('index.php?sec=estado&sec2=operation/agentes/exportdata&date_from='.$date_from.'&date_to='.$year.'-'.$month.'-'.date('d',mktime(0, 0, 0, $month, $day_t, $year)).' 00:00:00'.'&year='.$year.'&month='.$month);
|
||||
}
|
||||
if (isset($date_from) && isset($date_to))
|
||||
{$date="&date_from=".$date_from."&date_to=".$date_to;}
|
||||
?>
|
||||
|
||||
<tr><td class='datost'><?php echo $lang_label["from"] ?>
|
||||
<input type="text" class="sub" name="from_date" value="<?php echo $date_from; ?>" size="21"><br><br>
|
||||
<?php
|
||||
//print calendar and links for next and previous months
|
||||
echo "
|
||||
<table><tr>
|
||||
<td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=".$month_a."&year=".$year_a.$date."'><font size =+1>«</font></a></td>
|
||||
<td>".generate_calendar($year, $month, $days_f, 3, NULL, $locale)."</td><td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=".$month_d."&year=".$year_d.$date."'><font size =+1>»</font></a></td>
|
||||
</tr></table>
|
||||
"; ?>
|
||||
<tr><td class='datost'><br><?php echo $lang_label["to"] ?> <input type="text" class="sub" name="to_date" value="<?php echo $date_to; ?>" size="21"><br><br>
|
||||
<?php
|
||||
//print calendar and links for next and previous months
|
||||
echo "
|
||||
<table><tr>
|
||||
<td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=".$month_a."&year=".$year_a.$date."'><font size =+1>«</font></a></td>
|
||||
<td>".generate_calendar($year, $month, $days_t, 3, NULL, $locale)."</td><td class='datost'><a href='index.php?sec=estado&sec2=operation/agentes/exportdata&month=".$month_d."&year=".$year_d.$date."'><font size =+1>»</font></a></td>
|
||||
</tr></table>
|
||||
"; ?>
|
||||
<tr class=datos><td><?php echo $lang_label["csv"] ?><td><input class="chk" type="checkbox" name="csv" value=0><br>
|
||||
|
||||
<tr><td></td></tr>
|
||||
<tr><td colspan=2 class="datos2b" align="right">
|
||||
<input type=submit name="copiar" class=sub value="<?php echo $lang_label["export"] ?>">
|
||||
</table></td></tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -1,25 +1,4 @@
|
|||
-- MySQL dump 10.10
|
||||
--
|
||||
-- Host: localhost Database: pandora
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.0.24a-Debian_9-log
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `estado_consola`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `estado_consola`;
|
||||
CREATE TABLE `estado_consola` (
|
||||
`id_usuario` varchar(50) NOT NULL,
|
||||
`idPerfilActivo` int(5) NOT NULL,
|
||||
|
@ -29,11 +8,7 @@ CREATE TABLE `estado_consola` (
|
|||
PRIMARY KEY (`id_usuario`)
|
||||
) ENGINE=MyISAM ;
|
||||
|
||||
--
|
||||
-- Table structure for table `objeto_consola`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `objeto_consola`;
|
||||
CREATE TABLE `objeto_consola` (
|
||||
`id_objeto` int(5) NOT NULL auto_increment,
|
||||
`nom_img` varchar(50) NOT NULL,
|
||||
|
@ -43,25 +18,16 @@ CREATE TABLE `objeto_consola` (
|
|||
`id_tipo` varchar(20) NOT NULL,
|
||||
`idVista` int(5) NOT NULL,
|
||||
PRIMARY KEY (`id_objeto`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 ;
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table `perfil`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `perfil`;
|
||||
CREATE TABLE `perfil` (
|
||||
`idPerfil` int(5) NOT NULL auto_increment,
|
||||
`Nombre` varchar(50) NOT NULL,
|
||||
`Descripcion` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`idPerfil`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 ;
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
--
|
||||
-- Table structure for table `perfil_vista`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `perfil_vista`;
|
||||
CREATE TABLE `perfil_vista` (
|
||||
`idPerfil` int(5) NOT NULL,
|
||||
`idVista` int(5) NOT NULL,
|
||||
|
@ -69,46 +35,21 @@ CREATE TABLE `perfil_vista` (
|
|||
PRIMARY KEY (`idPerfil`,`idVista`)
|
||||
) ENGINE=MyISAM ;
|
||||
|
||||
--
|
||||
-- Table structure for table `relacion_estado`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `relacion_estado`;
|
||||
CREATE TABLE `relacion_estado` (
|
||||
`id_objeto` int(5) NOT NULL,
|
||||
`relacion` varchar(50) NOT NULL,
|
||||
PRIMARY KEY (`id_objeto`)
|
||||
) ENGINE=MyISAM ;
|
||||
|
||||
--
|
||||
-- Table structure for table `relacion_objetos`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `relacion_objetos`;
|
||||
CREATE TABLE `relacion_objetos` (
|
||||
`idObjeto1` int(5) NOT NULL,
|
||||
`idObjeto2` int(5) NOT NULL,
|
||||
PRIMARY KEY (`idObjeto1`,`idObjeto2`)
|
||||
) ENGINE=MyISAM ;
|
||||
|
||||
--
|
||||
-- Table structure for table `vistas_consola`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `vistas_consola`;
|
||||
CREATE TABLE `vistas_consola` (
|
||||
`idVista` int(5) NOT NULL auto_increment,
|
||||
`nombre` varchar(50) NOT NULL,
|
||||
`descripcion` varchar(250) NOT NULL,
|
||||
PRIMARY KEY (`idVista`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
) ENGINE=MyISAM;
|
||||
|
|
|
@ -1,100 +1,8 @@
|
|||
-- MySQL dump 10.10
|
||||
--
|
||||
-- Host: localhost Database: pandora
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 5.0.24a-Debian_9-log
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `estado_consola`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `estado_consola` DISABLE KEYS */;
|
||||
LOCK TABLES `estado_consola` WRITE;
|
||||
INSERT INTO `estado_consola` VALUES ('admin',1,1,100,100);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `estado_consola` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `objeto_consola`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `objeto_consola` DISABLE KEYS */;
|
||||
LOCK TABLES `objeto_consola` WRITE;
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `objeto_consola` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `perfil`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `perfil` DISABLE KEYS */;
|
||||
LOCK TABLES `perfil` WRITE;
|
||||
INSERT INTO `perfil` VALUES (1,'perfil por defecto','perfil por defecto');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `perfil` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `perfil_vista`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `perfil_vista` DISABLE KEYS */;
|
||||
LOCK TABLES `perfil_vista` WRITE;
|
||||
INSERT INTO `perfil_vista` VALUES (1,1,1);
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `perfil_vista` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `relacion_estado`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `relacion_estado` DISABLE KEYS */;
|
||||
LOCK TABLES `relacion_estado` WRITE;
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `relacion_estado` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `relacion_objetos`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `relacion_objetos` DISABLE KEYS */;
|
||||
LOCK TABLES `relacion_objetos` WRITE;
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `relacion_objetos` ENABLE KEYS */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `vistas_consola`
|
||||
--
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `vistas_consola` DISABLE KEYS */;
|
||||
LOCK TABLES `vistas_consola` WRITE;
|
||||
INSERT INTO `vistas_consola` VALUES (1,'Main Board','');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `vistas_consola` ENABLE KEYS */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
|
|
Loading…
Reference in New Issue