Automatically generated installer lang files
[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
294ce987 6 if ($form = data_submitted()) { // form submitted, do not check referer (original page unknown)!
6e27c7c6 7
8 /// Only deal with real users
6f5e0852 9 if (!isloggedin()) {
6e27c7c6 10 redirect($CFG->wwwroot);
f9903ed0 11 }
12
6e27c7c6 13 /// Work out who to send the message to
14 if (!$admin = get_admin() ) {
f945d59b 15 print_error('cannotfindadmin', 'debug');
4ca5b473 16 }
6e27c7c6 17
94b9c2e8 18 $supportuser = new stdClass();
6e27c7c6 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;
d8aa5ec7
AD
22 // emailstop could be hard coded "false" to ensure error reports are sent
23 // but then admin's would have to alter their messaging preferences to temporarily stop them
24 $supportuser->emailstop = $admin->emailstop;
6e27c7c6 25 $supportuser->maildisplay = true;
26
3b120e46 27 /// Send the message and redirect
94b9c2e8 28 $eventdata = new stdClass();
3b120e46 29 $eventdata->modulename = 'moodle';
30 $eventdata->userfrom = $USER;
31 $eventdata->userto = $supportuser;
32 $eventdata->subject = 'Error: '. $form->referer .' -> '. $form->requested;
33 $eventdata->fullmessage = $form->text;
34 $eventdata->fullmessageformat = FORMAT_PLAIN;
35 $eventdata->fullmessagehtml = '';
2044a2b2 36 $eventdata->smallmessage = '';
7c7d3afa 37 message_send($eventdata);
6f5e0852 38
70e728fb 39 redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
6e27c7c6 40 exit;
f9903ed0 41 }
e80e60a6 42
43 $site = get_site();
6cbaa56a 44 $redirecturl = empty($_SERVER['REDIRECT_URL']) ? '' : $_SERVER['REDIRECT_URL'];
45 $httpreferer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
46 $requesturi = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
6f5e0852 47
6e27c7c6 48 header("HTTP/1.0 404 Not Found");
49 header("Status: 404 Not Found");
50
a6855934 51 $PAGE->set_url('/error/');
70f25518 52 $PAGE->set_title($site->fullname .':Error');
53 $PAGE->set_heading($site->fullname .': Error 404');
b276cf9e 54 $PAGE->set_context(get_system_context());
70f25518 55 $PAGE->navbar->add('Error 404 - File not Found');
56 echo $OUTPUT->header();
aa9a6867 57 echo $OUTPUT->box(get_string('pagenotexist', 'error'). '<br />'.s($requesturi), 'generalbox boxaligncenter');
6e27c7c6 58
59 if (isloggedin()) {
f9903ed0 60?>
6e27c7c6 61 <p><?php echo get_string('pleasereport', 'error'); ?>
62 <p><form action="<?php echo $CFG->wwwroot ?>/error/index.php" method="post">
63 <textarea rows="3" cols="50" name="text" id="text"></textarea><br />
64 <input type="hidden" name="referer" value="<?php p($httpreferer) ?>">
65 <input type="hidden" name="requested" value="<?php p($requesturi) ?>">
66 <input type="submit" value="<?php echo get_string('sendmessage', 'error'); ?>">
67 </form>
c8848161 68<?php
6e27c7c6 69 } else {
aa9a6867 70 echo $OUTPUT->continue_button($CFG->wwwroot);
6e27c7c6 71 }
7e0d6675 72 echo $OUTPUT->footer();
6573940c 73?>