1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?php
/**
* Error handling
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
*
* @package evocore
*/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
if( !isset( $errors ) )
{
$errors = array();
}
/**
* add error to list
*/
function errors_add( $string )
{
global $errors;
// echo 'error:'.$string;
$errors[] = $string;
}
function errors()
{
global $errors;
return count( $errors );
}
function errors_display( $head, $foot, $display = true )
{
global $errors;
if( ! count( $errors ) )
{
// echo 'NO ERROR';
return false;
}
$disp = '<div class="error"><p class="error">'.$head.'</p><ul class="error">';
foreach( $errors as $error )
{
$disp .= '<li class="error">'.$error.'</li>';
}
$disp .= '</ul><p class="error">'.$foot.'</p></div>';
if( $display )
{
echo $disp;
return true;
}
return $disp;
}
function errors_string( $head, $foot )
{
global $errors;
if( ! count( $errors ) )
{
return false;
}
return strip_tags($head.' '.implode(', ',$errors).' '.$foot);
}
?>
|