r173: Renaming the error reporting stuff so it can also handle non-error messages...
[bugdar.git] / includes / class_error.php
1 <?php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
12
13 class Message_Reporter
14 {
15 var $phrase = null;
16 var $process = '';
17
18 function error($text = '')
19 {
20 global $bugsys;
21
22 if (is_array($this->phrase) AND empty($this->process))
23 {
24 trigger_error('Message_Reporter::phrase is an array so please use Message_Reporter::error_list_process() to prepare it', E_USER_ERROR);
25 }
26
27 if (empty($this->process))
28 {
29 $this->process = phrase($this->phrase);;
30 }
31
32 $this->process = (($text) ? $text : $this->process);
33
34 $errormessage = $this->process;
35
36 eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_error') . '");');
37 exit;
38 }
39
40 function error_list_process()
41 {
42 if (!is_array($this->phrase) OR count($this->phrase) < 1)
43 {
44 return;
45 }
46
47 $this->process = "\n\n<ol style=\"list-style-type: decimal\">";
48 foreach ($this->phrase AS $phrase)
49 {
50 $this->process .= "\n\t<li>" . phrase($phrase) . "</li>";
51 }
52 $this->process .= "\n</ol>";
53 }
54
55 function error_permission()
56 {
57 $this->phrase = 'error_no_permission';
58 $this->throw();
59 }
60 }
61
62 /*=====================================================================*\
63 || ###################################################################
64 || # $HeadURL$
65 || # $Id$
66 || ###################################################################
67 \*=====================================================================*/
68 ?>