MDL-49650 Templates: Move templates out of invalid sub directory.
[moodle.git] / error / index.php
CommitLineData
ed1dcb9d 1<?php
f9903ed0 2
70e728fb 3 require('../config.php');
3b120e46 4 require_once($CFG->libdir.'/eventslib.php');
f9903ed0 5
af0afab3
RT
6 // Form submitted, do not check referer (original page unknown).
7 if ($form = data_submitted()) {
8 // Only deal with real users.
6f5e0852 9 if (!isloggedin()) {
6e27c7c6 10 redirect($CFG->wwwroot);
f9903ed0 11 }
12
3bcf6b3c 13 // Send the message and redirect.
94b9c2e8 14 $eventdata = new stdClass();
3bcf6b3c
RT
15 $eventdata->component = 'moodle';
16 $eventdata->name = 'errors';
3b120e46 17 $eventdata->userfrom = $USER;
3bcf6b3c 18 $eventdata->userto = core_user::get_support_user();
3b120e46 19 $eventdata->subject = 'Error: '. $form->referer .' -> '. $form->requested;
20 $eventdata->fullmessage = $form->text;
21 $eventdata->fullmessageformat = FORMAT_PLAIN;
22 $eventdata->fullmessagehtml = '';
2044a2b2 23 $eventdata->smallmessage = '';
7c7d3afa 24 message_send($eventdata);
6f5e0852 25
70e728fb 26 redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
6e27c7c6 27 exit;
f9903ed0 28 }
e80e60a6 29
30 $site = get_site();
6cbaa56a 31 $redirecturl = empty($_SERVER['REDIRECT_URL']) ? '' : $_SERVER['REDIRECT_URL'];
32 $httpreferer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
33 $requesturi = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
6f5e0852 34
6e27c7c6 35 header("HTTP/1.0 404 Not Found");
36 header("Status: 404 Not Found");
37
a6855934 38 $PAGE->set_url('/error/');
54bc6d19 39 $PAGE->set_context(context_system::instance());
70f25518 40 $PAGE->set_title($site->fullname .':Error');
41 $PAGE->set_heading($site->fullname .': Error 404');
42 $PAGE->navbar->add('Error 404 - File not Found');
43 echo $OUTPUT->header();
aa9a6867 44 echo $OUTPUT->box(get_string('pagenotexist', 'error'). '<br />'.s($requesturi), 'generalbox boxaligncenter');
6e27c7c6 45
46 if (isloggedin()) {
f9903ed0 47?>
6e27c7c6 48 <p><?php echo get_string('pleasereport', 'error'); ?>
49 <p><form action="<?php echo $CFG->wwwroot ?>/error/index.php" method="post">
0ac97084 50 <textarea rows="3" cols="50" name="text" id="text" spellcheck="true"></textarea><br />
6e27c7c6 51 <input type="hidden" name="referer" value="<?php p($httpreferer) ?>">
52 <input type="hidden" name="requested" value="<?php p($requesturi) ?>">
53 <input type="submit" value="<?php echo get_string('sendmessage', 'error'); ?>">
54 </form>
c8848161 55<?php
6e27c7c6 56 } else {
aa9a6867 57 echo $OUTPUT->continue_button($CFG->wwwroot);
6e27c7c6 58 }
7e0d6675 59 echo $OUTPUT->footer();
6573940c 60?>