Updated the 19 build version to 20081103
[moodle.git] / error / index.php
blobfefcb33adfa124e0c4a6e495ed293b921d188a73
1 <?PHP // $Id$
3 require('../config.php');
5 if ($form = data_submitted('nomatch')) { // form submitted, do not check referer (original page unknown)!
7 /// Only deal with real users
8 if (!isloggedin()) {
9 redirect($CFG->wwwroot);
12 /// Work out who to send the message to
13 if (!$admin = get_admin() ) {
14 error('Could not find an admin user!');
17 $supportuser = new object;
18 $supportuser->email = $CFG->supportemail ? $CFG->supportemail : $admin->email;
19 $supportuser->firstname = $CFG->supportname ? $CFG->supportname : $admin->firstname;
20 $supportuser->lastname = $CFG->supportname ? '' : $admin->lastname;
21 $supportuser->maildisplay = true;
23 /// Send the email and redirect
24 email_to_user($supportuser, $USER, 'Error: '. $form->referer .' -> '. $form->requested, $form->text);
26 redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
27 exit;
30 $site = get_site();
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'];
35 header("HTTP/1.0 404 Not Found");
36 header("Status: 404 Not Found");
38 print_header($site->fullname .':Error', $site->fullname .': Error 404', 'Error 404 - File not Found', '');
40 print_simple_box('<p align="center">'. get_string('pagenotexist', 'error'). '<br />'.s($requesturi).'</p>', 'center');
42 if (isloggedin()) {
44 <center>
45 <p><?php echo get_string('pleasereport', 'error'); ?>
46 <p><form action="<?php echo $CFG->wwwroot ?>/error/index.php" method="post">
47 <textarea rows="3" cols="50" name="text" id="text"></textarea><br />
48 <input type="hidden" name="referer" value="<?php p($httpreferer) ?>">
49 <input type="hidden" name="requested" value="<?php p($requesturi) ?>">
50 <input type="submit" value="<?php echo get_string('sendmessage', 'error'); ?>">
51 </form>
52 <?php
53 } else {
54 print_continue($CFG->wwwroot);
56 print_footer();