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) { if ($error == null) { $error = $this->errorBox; } $tpl = new BSTemplate('std_error'); $tpl->vars = array('error' => $error); $tpl->evaluate()->flush(); 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) { if (bugdar::$options['redirectheaders']) { header("Location: $url"); exit; } $tpl = new BSTemplate('std_redirect'); $tpl->vars = array( 'message' => $message, 'url' => $url ); $tpl->evaluate()->flush(); exit; } // ################################################################### /** * Displays a fatal warning/notice that is usually not an error * * @param string Warning text */ function message($message) { $tpl = new BSTemplate('std_message'); $tpl->vars = array( 'message' => $message ); $tpl->evaluate()->flush(); 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 $show; $show['confirm'] = true; foreach ($arrextra as $name => $value) { $extra .= '' . "\n"; } $tpl = new BSTemplate('std_message'); $tpl->vars = array( 'message' => $message, 'action' => $action, 'do' => $do, 'button' => $button, 'cancel' => $cancel, 'extra' => $extra ); $tpl->evaluate()->flush(); exit; } } ?>