Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / enrol / paypal / return.php
blob1f2f4c2dc298a211929ebb4136bd2d1f4f4a41d0
1 <?php // $Id$
3 require("../../config.php");
4 require_once("$CFG->dirroot/enrol/paypal/enrol.php");
6 $id = required_param('id', PARAM_INT);
8 if (!$course = get_record("course", "id", $id)) {
9 redirect($CFG->wwwroot);
12 if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
13 redirect($CFG->wwwroot);
16 require_login();
18 /// Refreshing enrolment data in the USER session
19 load_all_capabilities();
21 if ($SESSION->wantsurl) {
22 $destination = $SESSION->wantsurl;
23 unset($SESSION->wantsurl);
24 } else {
25 $destination = "$CFG->wwwroot/course/view.php?id=$course->id";
28 if (has_capability('moodle/course:view', $context)) {
29 redirect($destination, get_string('paymentthanks', '', $course->fullname));
31 } else { /// Somehow they aren't enrolled yet! :-(
32 print_header();
33 notice(get_string('paymentsorry', '', $course), $destination);