MDL-35048 theme_formal_white: removed p {margin:0} from style/formal_white.css which...
[moodle.git] / error / index.php
blob0e57570747d9dce3b19b45f11c5342633f3411d7
1 <?php
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
9 if (!isloggedin()) {
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 // 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;
25 $supportuser->maildisplay = true;
27 /// Send the message and redirect
28 $eventdata = new stdClass();
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 = '';
36 $eventdata->smallmessage = '';
37 message_send($eventdata);
39 redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
40 exit;
43 $site = get_site();
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'];
48 header("HTTP/1.0 404 Not Found");
49 header("Status: 404 Not Found");
51 $PAGE->set_url('/error/');
52 $PAGE->set_title($site->fullname .':Error');
53 $PAGE->set_heading($site->fullname .': Error 404');
54 $PAGE->set_context(get_system_context());
55 $PAGE->navbar->add('Error 404 - File not Found');
56 echo $OUTPUT->header();
57 echo $OUTPUT->box(get_string('pagenotexist', 'error'). '<br />'.s($requesturi), 'generalbox boxaligncenter');
59 if (isloggedin()) {
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>
68 <?php
69 } else {
70 echo $OUTPUT->continue_button($CFG->wwwroot);
72 echo $OUTPUT->footer();