mirrored from git://git.moodle.org/moodle.git
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
return.php
36 lines (26 loc) · 971 Bytes
/
return.php
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
<?php // $Id$
require("../../config.php");
require_once("$CFG->dirroot/enrol/paypal/enrol.php");
$id = required_param('id', PARAM_INT);
if (!$course = get_record("course", "id", $id)) {
redirect($CFG->wwwroot);
}
if (! $context = get_context_instance(CONTEXT_COURSE, $course->id)) {
redirect($CFG->wwwroot);
}
require_login();
/// Refreshing enrolment data in the USER session
load_all_capabilities();
if ($SESSION->wantsurl) {
$destination = $SESSION->wantsurl;
unset($SESSION->wantsurl);
} else {
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
}
if (has_capability('moodle/course:view', $context)) {
redirect($destination, get_string('paymentthanks', '', $course->fullname));
} else { /// Somehow they aren't enrolled yet! :-(
print_header();
notice(get_string('paymentsorry', '', $course), $destination);
}
?>