File: index.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (43 lines) | stat: -rw-r--r-- 1,693 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?PHP // $Id: index.php,v 1.13.2.2 2006/05/15 15:44:36 skodak Exp $

    require('../config.php');

    if ($form = data_submitted('nomatch')) { // form submitted, do not check referer (origal page unknown)!
        if (!$admin = get_admin() ) {
            error('Could not find the admin user to mail to!');
        }

        if (empty($USER->id)) {
            $user = getremoteaddr(); // user not logged in, use IP address as name
        } else {
            $user = $USER;
        }
        email_to_user($admin, $user, 'Error: '. $form->referer .' -> '. $form->requested, $form->text);

        redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
        die;
    }

    $site = get_site();
    $redirecturl = empty($_SERVER['REDIRECT_URL']) ? '' : $_SERVER['REDIRECT_URL'];
    $httpreferer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
    $requesturi  = empty($_SERVER['REQUEST_URI'])  ? '' : $_SERVER['REQUEST_URI'];
    
    print_header($site->fullname .':Error', $site->fullname .': Error 404', '', 'form.text');
    print_simple_box('<p align="center">'. get_string('pagenotexist', 'error'). '<br />'.s($requesturi).'</p>', 'center');
  
?>
  
  <center>
  <p><?php echo get_string('pleasereport', 'error'); ?>
  <p><form action="<?php echo $CFG->wwwroot ?>/error/index.php" name="form" method="post">
     <textarea rows="3" cols="50" name="text"></textarea><br />
     <input type="hidden" name="referer" value="<?php p($httpreferer) ?>">
     <input type="hidden" name="requested" value="<?php p($requesturi) ?>">
     <input type="submit" value="<?php echo get_string('sendmessage', 'error'); ?>">
     </form>
<?php

  print_footer();

?>