3 require('../config.php');
4 require_once($CFG->libdir
.'/eventslib.php');
6 if ($form = data_submitted()) { // form submitted, do not check referer (original page unknown)!
8 /// Only deal with real users
10 redirect($CFG->wwwroot
);
13 /// Work out who to send the message to
14 if (!$admin = get_admin() ) {
15 print_error('cannotfindadmin', 'debug');
18 $supportuser = new stdClass();
19 $supportuser->email
= $CFG->supportemail ?
$CFG->supportemail
: $admin->email
;
20 $supportuser->firstname
= $CFG->supportname ?
$CFG->supportname
: $admin->firstname
;
21 $supportuser->lastname
= $CFG->supportname ?
'' : $admin->lastname
;
22 $supportuser->maildisplay
= true;
24 /// Send the message and redirect
25 $eventdata = new stdClass();
26 $eventdata->modulename
= 'moodle';
27 $eventdata->userfrom
= $USER;
28 $eventdata->userto
= $supportuser;
29 $eventdata->subject
= 'Error: '. $form->referer
.' -> '. $form->requested
;
30 $eventdata->fullmessage
= $form->text
;
31 $eventdata->fullmessageformat
= FORMAT_PLAIN
;
32 $eventdata->fullmessagehtml
= '';
33 $eventdata->smallmessage
= '';
34 message_send($eventdata);
36 redirect($CFG->wwwroot
.'/course/', 'Message sent, thanks', 3);
41 $redirecturl = empty($_SERVER['REDIRECT_URL']) ?
'' : $_SERVER['REDIRECT_URL'];
42 $httpreferer = empty($_SERVER['HTTP_REFERER']) ?
'' : $_SERVER['HTTP_REFERER'];
43 $requesturi = empty($_SERVER['REQUEST_URI']) ?
'' : $_SERVER['REQUEST_URI'];
45 header("HTTP/1.0 404 Not Found");
46 header("Status: 404 Not Found");
48 $PAGE->set_url('/error/');
49 $PAGE->set_title($site->fullname
.':Error');
50 $PAGE->set_heading($site->fullname
.': Error 404');
51 $PAGE->set_context(get_system_context());
52 $PAGE->navbar
->add('Error 404 - File not Found');
53 echo $OUTPUT->header();
54 echo $OUTPUT->box(get_string('pagenotexist', 'error'). '<br />'.s($requesturi), 'generalbox boxaligncenter');
58 <p
><?php
echo get_string('pleasereport', 'error'); ?
>
59 <p
><form action
="<?php echo $CFG->wwwroot ?>/error/index.php" method
="post">
60 <textarea rows
="3" cols
="50" name
="text" id
="text"></textarea
><br
/>
61 <input type
="hidden" name
="referer" value
="<?php p($httpreferer) ?>">
62 <input type
="hidden" name
="requested" value
="<?php p($requesturi) ?>">
63 <input type
="submit" value
="<?php echo get_string('sendmessage', 'error'); ?>">
67 echo $OUTPUT->continue_button($CFG->wwwroot
);
69 echo $OUTPUT->footer();