From: skodak Date: Tue, 23 Sep 2008 14:49:19 +0000 (+0000) Subject: MDL-16636 removing print_header() emulation hack X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f4c46179bfbce857d2604103e1300e683e7cd7fc;p=moodle.git MDL-16636 removing print_header() emulation hack --- diff --git a/message/send.php b/message/send.php index e13fd404b1..4a8d0eb49b 100644 --- a/message/send.php +++ b/message/send.php @@ -5,7 +5,7 @@ require('lib.php'); require_login(); -if (isguest()) { +if (isguestuser()) { redirect($CFG->wwwroot); } @@ -15,34 +15,9 @@ if (empty($CFG->messaging)) { if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTEM))) { -// if ($USER-> - -/// Don't use print_header, for more speed - $stylesheetshtml = ''; - foreach ($CFG->stylesheets as $stylesheet) { - $stylesheetshtml .= ''; - } - -/// Select direction - if ( get_string('thisdirection') == 'rtl' ) { - $direction = ' dir="rtl"'; - } else { - $direction = ' dir="ltr"'; - } - - @header('Content-Type: text/html; charset=utf-8'); - echo ''."\n"; - echo "\n\n"; - echo ''; - echo $stylesheetshtml; - - include($CFG->javascript); - - require_once($CFG->libdir .'/editor/htmlEditor.class.php'); - $htmlEditorObject = new htmlEditor(); - echo $htmlEditorObject->configure(); - - echo ' '; +/// (Don't use print_header, for more speed) +/// ehm - we have to use print_header() or else this breaks after any minor change in print_header()! + print_header(); /// Script parameters $userid = required_param('id', PARAM_INT); @@ -58,6 +33,7 @@ if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTE if ($contact = $DB->get_record('message_contacts', array('userid'=>$user->id, 'contactid'=>$USER->id))) { if ($contact->blocked and !has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { print_heading(get_string('userisblockingyou', 'message')); + print_footer('empty'); exit; } } @@ -66,12 +42,11 @@ if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTE if (!empty($userpreferences['message_blocknoncontacts'])) { // User is blocking non-contacts if (empty($contact)) { // We are not a contact! print_heading(get_string('userisblockingyounoncontact', 'message')); + print_footer('empty'); exit; } } - echo ''; - if ($message!='' and confirm_sesskey()) { /// Current user has just sent a message /// Save it to the database... @@ -129,6 +104,6 @@ if (has_capability('moodle/site:sendmessage', get_context_instance(CONTEXT_SYSTE "\n//]]>". "\n"; - echo ''; + print_footer('empty'); } ?>