r304: Added tab navigation system.
[bugdar.git] / includes / class_message_reporter.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 $url = '';
16 var $useheaders = false;
17
18 var $phrase = null;
19 var $process = '';
20
21 function error($text = '')
22 {
23 global $bugsys;
24 global $doctype, $header, $headinclude, $footer, $focus, $show;
25
26 if (is_array($this->phrase) AND empty($this->process))
27 {
28 trigger_error('Message_Reporter::phrase is an array so please use Message_Reporter::error_list_process() to prepare it', E_USER_ERROR);
29 }
30
31 if (empty($this->process))
32 {
33 $this->process = lang::p($this->phrase);
34 }
35
36 $this->process = (($text) ? $text : $this->process);
37
38 $errormessage = $this->process;
39
40 eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_error') . '");');
41 exit;
42 }
43
44 function error_list_process()
45 {
46 if (!is_array($this->phrase) OR count($this->phrase) < 1)
47 {
48 return;
49 }
50
51 $this->process = "\n\n<ol style=\"list-style-type: decimal\">";
52 foreach ($this->phrase AS $phrase)
53 {
54 $this->process .= "\n\t<li>" . lang::p($phrase) . "</li>";
55 }
56 $this->process .= "\n</ol>";
57 }
58
59 function error_permission()
60 {
61 $this->phrase = 'error_no_permission';
62 $this->error();
63 }
64
65 function redirect($text = '', $url = '')
66 {
67 global $bugsys;
68 global $doctype, $header, $headinclude, $footer, $focus, $show;
69
70 if (is_array($this->phrase) AND empty($this->process))
71 {
72 trigger_error('Message_Reporter::phrase is an array and cannot be used in Message_Reporter::redirect()', E_USER_ERROR);
73 }
74
75 if (empty($this->process))
76 {
77 $this->process = lang::p($this->phrase);
78 }
79
80 $this->process = (($text) ? $text : $this->process);
81 $this->url = (($url) ? $url : $this->url);
82
83 $redirectmessage = $this->process;
84 $redirecturl = $this->url;
85
86 eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect') . '");');
87
88 if ($this->useheaders)
89 {
90 header("Location: {$this->url}");
91 }
92
93 exit;
94 }
95
96 function message($text = '')
97 {
98 global $bugsys;
99 global $doctype, $header, $headinclude, $footer, $focus, $show;
100
101 if (is_array($this->phrase) AND empty($this->process))
102 {
103 trigger_error('Message_Reporter::phrase is an array and cannot be used in Message_Reporter::message()', E_USER_ERROR);
104 }
105
106 if (empty($this->process))
107 {
108 $this->process = lang::p($this->phrase);
109 }
110
111 $this->process = (($text) ? $text : $this->process);
112
113 $message = $this->process;
114
115 eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");');
116 exit;
117 }
118 }
119
120 /*=====================================================================*\
121 || ###################################################################
122 || # $HeadURL$
123 || # $Id$
124 || ###################################################################
125 \*=====================================================================*/
126 ?>