getCustomDirName(); //Inicializamos algunos valores if($_REQUEST['db_fecha']!='') $valorFecha = $_REQUEST['db_fecha']; else $valorFecha = date('d/m/y H:i:s'); //autoreload if($_REQUEST['autoreload']!='') $valorAutoreload = 'checked'; else $valorAutoreload = ''; //Comprobamos si ha pulsado alguno de los botones que indican tiempo switch ($_REQUEST['Refrescar']){ case 'Ayer': $valorFecha = date('d/m/y H:i:s',strtotime("-1 day")); break; case 'Hoy': $valorFecha = date('d/m/y')." 00:00:00"; break; case '-10m': $valorFecha = date('d/m/y H:i:s',strtotime("-10 minutes")); break; case '-5m': $valorFecha = date('d/m/y H:i:s',strtotime("-5 minutes")); break; case 'Ya!': $valorFecha = date('d/m/y H:i:s'); } if($_REQUEST['db_usuario']!='') $valorUsuario = strtoupper($_REQUEST['db_usuario']); else $valorUsuario = ''; if($_REQUEST['db_aplicacion']!='') $valorAplicacion = $_REQUEST['db_aplicacion']; else{ $fichero = '../gvHidraConfig.inc.xml'; if (file_exists($fichero)) { $sXML = simplexml_load_file($fichero); $nombreApp = (string) $sXML->applicationName; unset($sXML);//Liberamos el recurso $valorAplicacion = $nombreApp; } } if($_REQUEST["db_tipo"]!='') $valorTipo = $_REQUEST["db_tipo"]; else $valorTipo = 5; //Comprobamos si tenemos que calcular la consulta $error_bd = ''; $resultDatos = array(); if(($valorAplicacion!='') and ($valorFecha!='')){ //REVIEW: Toni Provisional hasta que este todo acabado. if (ConfIgep::es_desarrollo()) { $dsn_log = array( 'phptype' => 'pgsql', 'username' => 'igep_alog', 'password' => 'errlog', 'hostspec' => 'rosa.coput.gva.es', 'database' => 'marte', ); } else{ $dsn_log = array( 'phptype' => 'pgsql', 'username' => 'igep_alog', 'password' => 'errlog', 'hostspec' => 'adolfo', 'database' => 'marte', ); } require_once('MDB2.php'); $conexion = MDB2::connect($dsn_log); if (PEAR::isError($conexion)){ die('Error de conexion a BD -> '.$conexion->getMessage()); } $conexion->setFetchMode(MDB2_FETCHMODE_ASSOC); // cosas extraidas del postconexion de igep_bd if ($dsn_log['phptype']=='pgsql') { $result = $conexion->exec('set session datestyle = \'sql, european\''); if (PEAR::isError($result)) die('Error al fijar encoding'); $result = $conexion->exec('set client_encoding=\'LATIN1\''); if (PEAR::isError($result)) die('Error al fijar variables de sesión datestyle'); $dt = Date_User2FW($valorFecha); $valorFechaQuery = $dt->format('d/m/Y H:i:s'); } elseif ($dsn_log['phptype']=='mysqli') { $result = $conexion->exec('set names \'LATIN1\''); if (PEAR::isError($result)) die('Error al fijar encoding'); $dt = Date_User2FW($valorFecha); $valorFechaQuery = $dt->format('Y-m-d H:i:s'); } elseif ($dsn_log['phptype']=='oci8') { $result = $conexion->exec('alter session set nls_date_format=\'dd/mm/yyyy hh24:mi:ss\''); if (PEAR::isError($result)) die('Error al fijar formato fechas'); $dt = Date_User2FW($valorFecha); $valorFechaQuery = $dt->format('d/m/Y H:i:s'); } else throw new Exception('Tipo de DBMS desconocido: '.$dsn_log['phptype']); //si hay usuario if($_REQUEST['db_usuario']!='') $whereUsuario = "and usuario='".$_REQUEST['db_usuario']."'"; $select = "SELECT iderror,aplicacion,modulo,version,usuario,fecha as \"fecha\",tipo,mensaje FROM tcmn_errlog WHERE aplicacion='".$valorAplicacion."' and fecha>'".$valorFechaQuery."' and tipo<=".$valorTipo." $whereUsuario ORDER BY iderror DESC"; $res = $conexion->query($select); if(PEAR::isError($res)) { $resultDatos = array(); echo 'Error en consulta: '.$res->getMessage(); } else $resultDatos = $res->fetchAll(); } $htmlResult = ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= 'Debugger de gvHIDRA'; $htmlResult.= ''; //REVIEW: creo que el visor del debugger debería estar en el custom $htmlResult.= ""; $htmlResult.= ''; $htmlResult.= ''; //Para meter los parámetros de la consulta $htmlResult.= "
"; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= '
'; $htmlResult.= 'Criterios de filtrado'; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= '  Auto '; $htmlResult.= '
'; $htmlResult.= 'Usuario: '; $htmlResult.= ''; $htmlResult.= '  Fecha: '; $htmlResult.= '  '; $htmlResult.= ' '; $htmlResult.= ' '; $htmlResult.= ' '; $htmlResult.= ' '; $htmlResult.= ''; $htmlResult.= '  Tipo: '; $htmlResult.= ''; $htmlResult.= '  Aplicación: '; $htmlResult.= '
'; $htmlResult.= '
'; $htmlResult.= '
'; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; if(empty($valorUsuario)){ $htmlResult.= ''; } $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; //Iteramos para mostrar los resultados if(count($resultDatos)==0){ $htmlResult.= ''; if(empty($valorUsuario)) $htmlResult.= ''; $htmlResult.= ''; } else{ foreach($resultDatos as $indice=>$tupla){ $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; if(empty($valorUsuario)){ $htmlResult.= ''; } $htmlResult.= ''; $htmlResult.= ''; $htmlResult.= ''; } } $htmlResult.= '
'; $htmlResult.= 'Nº'; $htmlResult.= ''; $htmlResult.= 'FECHA'; $htmlResult.= ''; $htmlResult.= 'USUARIO'; $htmlResult.= ''; $htmlResult.= 'TIPO'; $htmlResult.= ''; $htmlResult.= 'MENSAJE'; $htmlResult.= '
'; else $htmlResult.= ''; $htmlResult.= 'NO HAY DATOS'; $htmlResult.= '
'; $htmlResult.= ($indice+1); $htmlResult.= ''; $htmlResult.= $tupla['fecha']; $htmlResult.= ''; $htmlResult.= $tupla['usuario']; $htmlResult.= ''; switch($tupla['tipo']){ case 0: $htmlResult.= 'PANIC'; break; case 1: $htmlResult.= 'ERROR'; break; case 2: $htmlResult.= 'WARNING'; break; case 3: $htmlResult.= 'NOTICE'; break; case 4: $htmlResult.= 'DEBUG_USER'; break; case 5: $htmlResult.= 'DEBUG_IGEP'; break; } $htmlResult.= ''; $htmlResult.= $tupla['mensaje']; $htmlResult.= '
'; $htmlResult.= ''; $htmlResult.= ''; echo $htmlResult; ?>