]>
src.bluestatic.org Git - bugdar.git/blob - class_message_reporter.php
26490abf7aa87d41ea43c1387d5899ee3a5951e4
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]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 \*=====================================================================*/
13 class Message_Reporter
16 * The URL used for redirect
22 * Use a Location header to redirect
25 var $useheaders = false ;
28 * Phrase array; null by default
34 * The processed text for a message
40 * Throws a fatal user-end error message
42 * @param string The text of a message
44 function error ( $text = '' )
47 global $doctype , $header , $headinclude , $footer , $focus , $show , $stylevar ;
49 if ( count ( $this- > items
) > 0 AND empty ( $this- > process
))
51 trigger_error ( 'Message_Reporter->items is an array so please use Message_Reporter->error_list_process() to prepare it' , E_USER_ERROR
);
54 $this- > process
= ( $text ? $text : $this- > process
);
56 $this- > check_process ();
58 eval ( ' $bugsys- >template->flush("' . $bugsys- > template
-> fetch ( 'std_error' ) . '");' );
63 * Converts the phrase array into a list for use in error()
65 function error_list_process ()
67 if (! is_array ( $this- > items
) OR count ( $this- > items
) < 1 )
72 $this- > process
= " \n\n <ol style= \" list-style-type: decimal \" >" ;
73 foreach ( $this- > items
AS $phrase )
75 $this- > process
.= " \n\t <li>" . $phrase . "</li>" ;
77 $this- > process
.= " \n </ol>" ;
81 * Throws a common no-permission error
83 function error_permission ()
87 $this- > error ( $bugsys- > lang
-> string ( 'You do not have permission to access this page. If you think that this is an error, please contact an administrator.' ));
91 * Performs a front-end redirect by either header or <meta>
93 * @param string Redirect message text
94 * @param string URL to take the user
96 function redirect ( $text = '' , $url = '' )
99 global $doctype , $header , $headinclude , $footer , $focus , $show , $stylevar ;
101 $this- > process
= ( $text ? $text : $this- > process
);
102 $this- > url
= ( $url ? $url : $this- > url
);
104 $this- > check_process ();
106 eval ( ' $bugsys- >template->flush("' . $bugsys- > template
-> fetch ( 'std_redirect' ) . '");' );
108 if ( $this- > useheaders
)
110 header ( "Location: {$this->url} " );
117 * Displays a fatal warning/notice that is usually not an error
119 * @param string Warning text
121 function message ( $text = '' )
124 global $doctype , $header , $headinclude , $footer , $focus , $show , $stylevar ;
126 $this- > process
= ( $text ? $text : $this- > process
);
128 $this- > check_process ();
130 eval ( ' $bugsys- >template->flush("' . $bugsys- > template
-> fetch ( 'std_message' ) . '");' );
135 * Checks to make sure that there is some text in the processed variable
137 function check_process ()
139 if ( empty ( $this- > process
))
141 trigger_error ( 'Message_Reporter requires some text to display a message' , E_USER_ERROR
);
146 /*=====================================================================*\
147 || ###################################################################
150 || ###################################################################
151 \*=====================================================================*/