return false;
}
+/**
+ * Print an error page displaying an error message.
+ * Old method, don't call directly in new code - use print_error instead.
+ *
+ *
+ * @uses $SESSION
+ * @uses $CFG
+ * @param string $message The message to display to the user about the error.
+ * @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
+ */
+function error ($message, $link='') {
+
+ global $CFG, $SESSION, $THEME;
+ $message = clean_text($message); // In case nasties are in here
+
+ if (defined('FULLME') && FULLME == 'cron') {
+ // Errors in cron should be mtrace'd.
+ mtrace($message);
+ die;
+ }
+
+ if (! defined('HEADER_PRINTED')) {
+ //header not yet printed
+ @header('HTTP/1.0 404 Not Found');
+ print_header(get_string('error'));
+ } else {
+ print_container_end_all(false, $THEME->open_header_containers);
+ }
+
+ echo '<br />';
+ print_simple_box($message, '', '', '', '', 'errorbox');
+
+ debugging('Stack trace:', DEBUG_DEVELOPER);
+
+ // in case we are logging upgrade in admin/index.php stop it
+ if (function_exists('upgrade_log_finish')) {
+ upgrade_log_finish();
+ }
+
+ if (empty($link) and !defined('ADMIN_EXT_HEADER_PRINTED')) {
+ if ( !empty($SESSION->fromurl) ) {
+ $link = $SESSION->fromurl;
+ unset($SESSION->fromurl);
+ } else {
+ $link = $CFG->wwwroot .'/';
+ }
+ }
+
+ if (!empty($link)) {
+ print_continue($link);
+ }
+
+ print_footer();
+
+ for ($i=0;$i<512;$i++) { // Padding to help IE work with 404
+ echo ' ';
+ }
+
+ die;
+}
?>
}
}
-/**
- * Print an error page displaying an error message.
- * Old method, don't call directly in new code - use print_error instead.
- *
- *
- * @uses $SESSION
- * @uses $CFG
- * @param string $message The message to display to the user about the error.
- * @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page.
- */
-function error ($message, $link='') {
-
- global $CFG, $SESSION, $THEME;
- $message = clean_text($message); // In case nasties are in here
-
- if (defined('CLI_UPGRADE') && CLI_UPGRADE) {
- console_write(STDERR,$message,'',false);
- die ;
- }
-
- if (defined('FULLME') && FULLME == 'cron') {
- // Errors in cron should be mtrace'd.
- mtrace($message);
- die;
- }
-
- if (defined('UNITTEST')) {
- // Errors in unit test become exceptions, so you can unit test
- // code that might call error().
- throw new Exception('error() call: '.
- $message.($link!=='' ? ' ['.$link.']' : ''));
- }
-
- if (! defined('HEADER_PRINTED')) {
- //header not yet printed
- @header('HTTP/1.0 404 Not Found');
- print_header(get_string('error'));
- } else {
- print_container_end_all(false, $THEME->open_header_containers);
- }
-
- echo '<br />';
- print_simple_box($message, '', '', '', '', 'errorbox');
-
- debugging('Stack trace:', DEBUG_DEVELOPER);
-
- // in case we are logging upgrade in admin/index.php stop it
- if (function_exists('upgrade_log_finish')) {
- upgrade_log_finish();
- }
-
- if (empty($link) and !defined('ADMIN_EXT_HEADER_PRINTED')) {
- if ( !empty($SESSION->fromurl) ) {
- $link = $SESSION->fromurl;
- unset($SESSION->fromurl);
- } else {
- $link = $CFG->wwwroot .'/';
- }
- }
-
- if (!empty($link)) {
- print_continue($link);
- }
-
- print_footer();
-
- for ($i=0;$i<512;$i++) { // Padding to help IE work with 404
- echo ' ';
- }
-
- die;
-}
-
/**
* Print an error page displaying an error message. New method - use this for new code.
*