diff --git a/message/history.php b/message/history.php deleted file mode 100644 index 9ca86af6253..00000000000 --- a/message/history.php +++ /dev/null @@ -1,118 +0,0 @@ -. - -/** - * For listing message histories between any two users - * - * @author Luis Rodrigues and Martin Dougiamas - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package message - */ - -require('../config.php'); -require('lib.php'); - -require_login(); - -if (isguestuser()) { - redirect($CFG->wwwroot); -} - -if (empty($CFG->messaging)) { - print_error('disabled', 'message'); -} - -/// Script parameters -$userid1 = optional_param('user1', $USER->id, PARAM_INT); -$userid2 = required_param('user2', PARAM_INT); -$popup = optional_param('popup', 0, PARAM_INT); - -$url = new moodle_url('/message/history.php'); -$url->param('user1', $userid1); -if (!empty($userid2)) { - $url->param('user2', $userid2); -} -$PAGE->set_url($url); - -$PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id)); - -$iscurrentuser = $USER->id == $userid1; - -if ($iscurrentuser) { - $PAGE->navigation->extend_for_user($USER); -} else { - $PAGE->navigation->extend_for_user($DB->get_record('user',array('id'=>$userid1))); -} -$PAGE->navigation->extend_for_user($DB->get_record('user',array('id'=>$userid2))); - - -$strmessagehistory = get_string('messagehistory', 'message'); -if (!$popup) { - if ($iscurrentuser) { - $PAGE->navigation->get('myprofile')->get('messages')->make_active(); - } else { - $PAGE->navigation->find($userid1,navigation_node::TYPE_USER)->make_active(); - } - - $PAGE->navbar->add($strmessagehistory); - - $PAGE->set_pagelayout('course'); - $PAGE->set_heading($strmessagehistory); -} -$PAGE->set_title($strmessagehistory); - - -// Are we able to see other user's discussions? -if (has_capability('moodle/site:readallmessages', get_context_instance(CONTEXT_SYSTEM))) { - if (! $user1 = $DB->get_record("user", array("id"=>$userid1))) { - print_error('invaliduserid'); - } - if ($user1->deleted) { - echo $OUTPUT->header(); - echo $OUTPUT->heading(get_string('userdeleted').': '.$userid1, 1); - echo $OUTPUT->footer(); - die; - } -} else { - //User can only see their own discussions - $userid1 = $USER->id; - $user1 = $USER; -} - -if (! $user2 = $DB->get_record("user", array("id"=>$userid2))) { // Check - print_error('invaliduserid'); -} -if ($user2->deleted) { - echo $OUTPUT->header(); - echo $OUTPUT->heading(get_string('userdeleted').': '.$userid2, 1); - echo $OUTPUT->footer(); - die; -} - -$search = optional_param('search', '', PARAM_CLEAN); //TODO: use PARAM_RAW, but make sure we use s() and p() properly - -add_to_log(SITEID, 'message', 'history', 'history.php?user1='.$userid1.'&user2='.$userid2, $userid1); - -/// Our two users are defined - let's set up the page - -echo $OUTPUT->header(); - -/// Print out a heading including the users we are looking at -message_print_message_history($user1, $user2, $search); - -echo $OUTPUT->footer(); - diff --git a/message/index.php b/message/index.php index fddcef250d1..8ce7ade002d 100644 --- a/message/index.php +++ b/message/index.php @@ -108,20 +108,20 @@ if ($user1->id!=$USER->id && $user2->id!=$USER->id && !has_capability('moodle/si /// Process any contact maintenance requests there may be if ($addcontact and confirm_sesskey()) { - add_to_log(SITEID, 'message', 'add contact', 'history.php?user1='.$addcontact.'&user2='.$USER->id, $addcontact); + add_to_log(SITEID, 'message', 'add contact', 'index.php?user1='.$addcontact.'&user2='.$USER->id, $addcontact); message_add_contact($addcontact); redirect($CFG->wwwroot . '/message/index.php?usergroup=contacts&id='.$addcontact); } if ($removecontact and confirm_sesskey()) { - add_to_log(SITEID, 'message', 'remove contact', 'history.php?user1='.$removecontact.'&user2='.$USER->id, $removecontact); + add_to_log(SITEID, 'message', 'remove contact', 'index.php?user1='.$removecontact.'&user2='.$USER->id, $removecontact); message_remove_contact($removecontact); } if ($blockcontact and confirm_sesskey()) { - add_to_log(SITEID, 'message', 'block contact', 'history.php?user1='.$blockcontact.'&user2='.$USER->id, $blockcontact); + add_to_log(SITEID, 'message', 'block contact', 'index.php?user1='.$blockcontact.'&user2='.$USER->id, $blockcontact); message_block_contact($blockcontact); } if ($unblockcontact and confirm_sesskey()) { - add_to_log(SITEID, 'message', 'unblock contact', 'history.php?user1='.$unblockcontact.'&user2='.$USER->id, $unblockcontact); + add_to_log(SITEID, 'message', 'unblock contact', 'index.php?user1='.$unblockcontact.'&user2='.$USER->id, $unblockcontact); message_unblock_contact($unblockcontact); }