示例#1
0
/*
      +----------------------------------------------------------------------+
      | andromeda:  miguel Framework, written in PHP                         |
      +----------------------------------------------------------------------+
      | Copyright (c) 2003,2004 miguel Development Team                      |
      +----------------------------------------------------------------------+
      |   This library is free software; you can redistribute it and/or      |
      |   modify it under the terms of the GNU Library General Public        |
      |   License as published by the Free Software Foundation; either       | 
      |   version 2 of the License, or (at your option) any later version.   |
      |                                                                      |
      |   This library 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  |
      |   Library General Public License for more details.                   |
      |                                                                      |
      |   You should have received a copy of the GNU Library General Public  |
      |   License along with this program; if not, write to the Free         |
      |   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,    |
      |   MA 02111-1307, USA.                                                |      
      +----------------------------------------------------------------------+
      | Authors: Jesus A. Martinez Cerezal <*****@*****.**>              |
      |          miguel Development Team                                     |
      |                       <*****@*****.**>   |      
      +----------------------------------------------------------------------+
*/
//Sólo para desarrollo
include_once '../common/miguel_base.inc.php';
include_once Util::app_Path('error/control/classes/miguel_cerror.class.php');
$miguel = new miguel_CError();
$miguel->Exec();
 function processError($num_err, $mens_err, $nombre_archivo, $num_linea, $vars)
 {
     // conjunto de errores de los cuales se almacenara un rastreo
     $errores_de_usuario = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
     if (in_array($num_err, $errores_de_usuario)) {
         // marca de fecha/hora para el registro de error
         $dt = date('Y-m-d H:i:s (T)');
         // definir una matriz asociativa de cadenas de error
         // en realidad las unicas entradas que deberiamos
         // considerar son E_WARNING, E_NOTICE, E_USER_ERROR,
         // E_USER_WARNING y E_USER_NOTICE
         $tipo_error = array(E_ERROR => 'Error', E_WARNING => 'Advertencia', E_PARSE => 'Error de Intérprete', E_NOTICE => 'Anotación', E_CORE_ERROR => 'Error de Núcleo', E_CORE_WARNING => 'Advertencia de Núcleo', E_COMPILE_ERROR => 'Error de Compilación', E_COMPILE_WARNING => 'Advertencia de Compilacón', E_USER_ERROR => 'Error de Usuario', E_USER_WARNING => 'Advertencia de Usuario', E_USER_NOTICE => 'Anotación de Usuario');
         $err = "<errorentry>\n";
         $err .= "\t<datetime>" . $dt . "</datetime>\n";
         $err .= "\t<errornum>" . $num_err . "</errornum>\n";
         $err .= "\t<errortype>" . $tipo_error[$num_err] . "</errortype>\n";
         $err .= "\t<errormsg>" . $mens_err . "</errormsg>\n";
         if (!empty($nombre_archivo)) {
             $err .= "\t<scriptname>" . $nombre_archivo . "</scriptname>\n";
         }
         if (!empty($num_linea)) {
             $err .= "\t<scriptlinenum>" . $num_linea . "</scriptlinenum>\n";
         }
         //if (in_array($num_err, $errores_de_usuario)){
         //	$err .= "\t<vartrace>" . wddx_serialize_value($vars, "Variables") . "</vartrace>\n";
         //}
         $err .= "</errorentry>\n\n";
         // guardar en el registro de errores, y enviar un correo
         error_log($err, 3, MIGUELBASE_ERRORLOG_FILE);
         //)mail("*****@*****.**", "Error Critico de Usuario en miguel", $err);
         if ($num_err != E_USER_ERROR) {
             include_once Util::app_Path('error/control/classes/miguel_cerror.class.php');
             $obj_error = new miguel_CError($tipo_error[$num_err], $mens_err);
             $obj_error->Exec();
         } else {
             $err = "\n";
             $err .= "\tdatetime: " . $dt . "\n";
             $err .= "\terrornum: " . $num_err . "\n";
             $err .= "\terrortype: " . $tipo_error[$num_err] . "\n";
             $err .= "\terrormsg: " . $mens_err . "\n";
             if (!empty($nombre_archivo)) {
                 $err .= "\tscriptname: " . $nombre_archivo . "\n";
             }
             if (!empty($num_linea)) {
                 $err .= "\tscriptlinenum: " . $num_linea . "\n";
             }
             echo '<h1>Error Fatal</h1><br>';
             echo '<pre>' . $err . '</pre><br>';
             echo '<h3>Consulte con el administrador</h3><br>';
             Session::close();
             die;
         }
     }
 }