MDL-14085, Move error() to deprecatelib.php
This commit is contained in:
@@ -1616,4 +1616,64 @@ function document_file($file, $include=true) {
|
||||
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;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -5631,67 +5631,6 @@ function print_scale_menu_helpbutton($courseid, $scale, $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. New method - use this for new code.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user