b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _functions_errors.php

Documentation is available at _functions_errors.php

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

Documentation generated on Tue, 20 May 2008 01:54:51 +0200 by phpDocumentor 1.4.2