[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/error/ -> index.php (source)

   1  <?PHP // $Id: index.php,v 1.16.4.1 2008/02/01 05:48:43 moodler Exp $
   2  
   3      require ('../config.php');
   4  
   5      if ($form = data_submitted('nomatch')) { // form submitted, do not check referer (original page unknown)!
   6  
   7      /// Only deal with real users
   8          if (!isloggedin()) { 
   9              redirect($CFG->wwwroot);
  10          }
  11  
  12      /// Work out who to send the message to
  13          if (!$admin = get_admin() ) {
  14              error('Could not find an admin user!');
  15          }
  16  
  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;
  22  
  23      /// Send the email and redirect
  24          email_to_user($supportuser, $USER, 'Error: '. $form->referer .' -> '. $form->requested, $form->text);
  25  
  26          redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
  27          exit;
  28      }
  29  
  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'];
  34      
  35      header("HTTP/1.0 404 Not Found");
  36      header("Status: 404 Not Found");
  37  
  38      print_header($site->fullname .':Error', $site->fullname .': Error 404', 'Error 404 - File not Found', '');
  39  
  40      print_simple_box('<p align="center">'. get_string('pagenotexist', 'error'). '<br />'.s($requesturi).'</p>', 'center');
  41  
  42      if (isloggedin()) {
  43  ?>
  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);
  55      }
  56      print_footer();
  57  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7