From 60a5b1883313ab656009cac0da6657328b3cee81 Mon Sep 17 00:00:00 2001 From: tjhunt <tjhunt> Date: Mon, 13 Jul 2009 06:10:03 +0000 Subject: [PATCH] themes: MDL-19077 fix bugs in cli_renderer. Use correct doctype with legacy header.html. --- lib/outputlib.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index 9e9d843b2e..ff2a23f4c9 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -1845,6 +1845,11 @@ class moodle_core_renderer extends moodle_renderer_base { $header = substr($template, 0, $cutpos); $footer = substr($template, $cutpos + strlen(self::MAIN_CONTENT_TOKEN)); + if (empty($this->contenttype)) { + debugging('The layout template did not call $OUTPUT->doctype()'); + $this->doctype(); + } + send_headers($this->contenttype, $this->page->cacheable); $this->opencontainers->push('header/footer', $footer); $this->page->set_state(moodle_page::STATE_IN_BODY); @@ -1959,6 +1964,8 @@ class moodle_core_renderer extends moodle_renderer_base { ob_end_clean(); $output = str_replace('</body>', self::END_HTML_TOKEN . '</body>', $output); + // Make sure we use the correct doctype. + $output = preg_replace('/(<!DOCTYPE.+?>)/s', $this->doctype(), $output); return $output; } @@ -2667,7 +2674,7 @@ class cli_core_renderer extends moodle_core_renderer { } } - public function fatal_error($errorcode, $module, $a, $link, $backtrace, + public function fatal_error($message, $moreinfourl, $link, $backtrace, $debuginfo = null, $showerrordebugwarning = false) { $output = "!!! $message !!!\n"; @@ -2683,7 +2690,7 @@ class cli_core_renderer extends moodle_core_renderer { public function notification($message, $classes = 'notifyproblem') { $message = clean_text($message); - if ($style === 'notifysuccess') { + if ($classes === 'notifysuccess') { return "++ $message ++\n"; } return "!! $message !!\n"; -- 2.39.5