]>
src.bluestatic.org Git - bugdar.git/blob - includes/class_message_reporter.php
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2002-2007 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
25 * Phrase array; null by default
29 var $errors = array();
32 * The processed text for a compound error
38 // ###################################################################
40 * Adds an error to the cumulative error list
44 * @param string Error message
46 function addError($message)
48 $this->errors
[] = $message;
51 // ###################################################################
53 * Returns TRUE if there are any errors from addError(), and FALSE if
54 * there are not. This also processes all the errors into a message
55 * block that can then be used in error()
57 * @return bool Whether there are any errors present
61 if (sizeof($this->errors
) < 1)
66 $this->errorBox
= "\n\n<ol style=\"list-style-type: decimal\">";
67 foreach ($this->errors
AS $err)
69 $this->errorBox
.= "\n\t<li>" . $err . "</li>";
71 $this->errorBox
.= "\n</ol>";
76 // ###################################################################
78 * Throws an actual error. If an error text is passed, it takes
79 * precedence over any processed list errors
81 * @param string Error text
83 function error($error = null)
86 global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
90 $error = $this->errorBox
;
93 eval('$bugsys->template->flush("' . $bugsys->template
->fetch('std_error') . '");');
97 // ###################################################################
99 * Throws a common no-permission error
101 function errorPermission()
103 $this->error(T('You do not have permission to access this page. If you think that this is an error, please contact an administrator.'));
106 // ###################################################################
108 * Performs a front-end redirect by either header or <meta>
110 * @param string Redirect message text
111 * @param string URL to take the user
113 function redirect($message, $url)
116 global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
118 if ($bugsys->options
['redirectheaders'])
120 header("Location: $url");
124 eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect
') . '");');
128 // ###################################################################
130 * Displays a fatal warning/notice that is usually not an error
132 * @param string Warning text
134 function message($message)
137 global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
139 eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message
') . '");');
143 // ###################################################################
145 * Displays a standard message template with extra confirm data on it
149 * @param string Message to confirm to
150 * @param string Form action
151 * @param string Do branch
152 * @param string Button text
153 * @param string Cancel action
154 * @param array Extra hidden information
156 function confirm($message, $action, $do, $button, $cancel, $arrextra)
159 global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
161 $show['confirm'] = true;
163 foreach ($arrextra AS $name => $value)
165 $extra .= '<input type="hidden
" name="' . $name . '" value="' . $value . '" />' . "\n
";
168 eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message
') . '");');