errors[] = $message; } // ################################################################### /** * Returns TRUE if there are any errors from addError(), and FALSE if * there are not. This also processes all the errors into a message * block that can then be used in error() * * @return bool Whether there are any errors present */ function hasErrors() { if (sizeof($this->errors) < 1) { return false; } $this->errorBox = "\n\n
    "; foreach ($this->errors AS $err) { $this->errorBox .= "\n\t
  1. " . $err . "
  2. "; } $this->errorBox .= "\n
"; return true; } // ################################################################### /** * Throws an actual error. If an error text is passed, it takes * precedence over any processed list errors * * @param string Error text */ function error($error = null) { global $bugsys; global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar; if ($error == null) { $error = $this->errorBox; } eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_error') . '");'); exit; } // ################################################################### /** * Throws a common no-permission error */ function errorPermission() { $this->error(T('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($message, $url) { global $bugsys; global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar; if ($bugsys->options['redirectheaders']) { header("Location: $url"); exit; } eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_redirect') . '");'); exit; } // ################################################################### /** * Displays a fatal warning/notice that is usually not an error * * @param string Warning text */ function message($message) { global $bugsys; global $doctype, $header, $headinclude, $footer, $focus, $show, $stylevar; 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; foreach ($arrextra AS $name => $value) { $extra .= '' . "\n"; } eval('$bugsys->template->flush("' . $bugsys->template->fetch('std_message') . '");'); exit; } }