items[] = $message;
}
/**
* Throws a fatal user-end error message
*
* @param string The text of a message
*/
function error($text = '')
{
global $bugsys;
global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
if (sizeof($this->items) > 0 AND empty($this->process))
{
trigger_error('Message_Reporter->items is an array so please use Message_Reporter->error_list_process() to prepare it', E_USER_ERROR);
}
$this->process = ($text ? $text : $this->process);
$this->check_process();
eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_error') . '");');
exit;
}
/**
* Converts the phrase array into a list for use in error()
*/
function error_list_process()
{
if (!is_array($this->items) OR sizeof($this->items) < 1)
{
return;
}
$this->process = "\n\n
";
foreach ($this->items AS $phrase)
{
$this->process .= "\n\t
" . $phrase . "
";
}
$this->process .= "\n";
}
/**
* Throws a common no-permission error
*/
function error_permission()
{
global $bugsys;
$this->error(_('You do not have permission to access this page. If you think that this is an error, please contact an administrator.'));
}
/**
* Performs a front-end redirect by either header or
*
* @param string Redirect message text
* @param string URL to take the user
*/
function redirect($text = '', $url = '')
{
global $bugsys;
global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
$this->process = ($text ? $text : $this->process);
$this->url = ($url ? $url : $this->url);
$this->check_process();
eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect') . '");');
if ($this->useheaders)
{
header("Location: {$this->url}");
}
exit;
}
/**
* Displays a fatal warning/notice that is usually not an error
*
* @param string Warning text
*/
function message($text = '')
{
global $bugsys;
global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
$this->process = ($text ? $text : $this->process);
$this->check_process();
eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");');
exit;
}
// ###################################################################
/**
* Displays a standard message template with extra confirm data on it
*
* @access public
*
* @param string Message to confirm to
* @param string Form action
* @param string Do branch
* @param string Button text
* @param string Cancel action
* @param array Extra hidden information
*/
function confirm($message, $action, $do, $button, $cancel, $arrextra)
{
global $bugsys;
global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar;
$show['confirm'] = true;
$this->process = $message;
foreach ($arrextra AS $name => $value)
{
$extra .= '' . "\n";
}
eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");');
exit;
}
/**
* Checks to make sure that there is some text in the processed variable
*/
function check_process()
{
if (empty($this->process))
{
trigger_error('Message_Reporter requires some text to display a message', E_USER_ERROR);
}
}
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>