]> git.mjollnir.org Git - moodle.git/commitdiff
Move error() to deprecatelib.php, merged from MOODLE_19_STABLE
authordongsheng <dongsheng>
Tue, 1 Apr 2008 04:15:13 +0000 (04:15 +0000)
committerdongsheng <dongsheng>
Tue, 1 Apr 2008 04:15:13 +0000 (04:15 +0000)
lib/deprecatedlib.php
lib/weblib.php

index 1c87f75d179042c56881206ffe3ce3694dfb64ce..5fa923876bd76f6aa011b247fd355460a4693218 100644 (file)
@@ -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;
+}
 ?>
index 9191b29a29e491d18e553e37041acbec61b9b7d7..d5f8aa57ae68e909a770ed3b3033dc9627c2622b 100644 (file)
@@ -5657,79 +5657,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('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.
  *