www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

erreur.php (1597B)


      1 <?php
      2 
      3 class Erreur {
      4 	public $type = "erreur";
      5 	public $message = "erreur";
      6 	public $string = "";
      7 	
      8 	public static function fatale($message, $html = false) {
      9 		echo '<?xml version="1.0" encoding="UTF-8"?>
     10 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     11 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
     12 	<head>
     13 		<title>Erreur</title>
     14 	</head>
     15 	<body>
     16 		<h2>Erreur</h2>
     17 		<p>Désolé, une erreur est survenue. Contactez le créateur du site SVP :
     18 		<a href="mailto:' . htmlspecialchars(Config::get('courriel_admin'))
     19 		. '?subject=Erreur%20dans%20le%20programme%202010-moteur-site-simple&body='
     20 		. htmlspecialchars(rawurlencode("Code de l'erreur : " . $message)) . '">'
     21 		. htmlspecialchars(Config::get('courriel_admin'))
     22 		. '</a>. Indiquez l\'erreur ci-dessous dans votre courriel.</p>
     23 		<p><strong>' . ($html ? $message : htmlspecialchars($message)) . '</strong></p>
     24 	</body>
     25 </html>';
     26 		//echo "\n"; debug_print_backtrace();
     27 		exit;
     28 	}
     29 	
     30 	public static function lecture($message) {
     31 		return new self("lecture", $message);
     32 	}
     33 	
     34 	public static function écriture($message) {
     35 		return new self("écriture", $message);
     36 	}
     37 	
     38 	public function __construct($type, $message, $string = null) {
     39 		if (is_null($string)) $string = "[ debug : erreur de " . $type . " ]";
     40 		$this->type = $type;
     41 		$this->message = $message;
     42 		$this->string = $string;
     43 	}
     44 	
     45 	public function __toString() {
     46 		return $this->string;
     47 	}
     48 	
     49 	public static function is_erreur($obj) {
     50 		return is_object($obj) && get_class($obj) === __CLASS__;
     51 	}
     52 }
     53 
     54 ?>