isguest() to has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM, SITEID), $USER->id, false)

This commit is contained in:
ethem 2006-09-22 15:31:04 +00:00
parent 65e2d1f0df
commit f0f8e34c5d
2 changed files with 4 additions and 4 deletions

View file

@ -45,6 +45,8 @@ class enrolment_plugin_authorize
return; return;
} }
httpsrequired();
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') { if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
if (empty($CFG->loginhttps)) { if (empty($CFG->loginhttps)) {
error(get_string('httpsrequired', 'enrol_authorize')); error(get_string('httpsrequired', 'enrol_authorize'));
@ -55,8 +57,6 @@ class enrolment_plugin_authorize
} }
} }
httpsrequired();
$strcourses = get_string('courses'); $strcourses = get_string('courses');
$strloginto = get_string('loginto', '', $course->shortname); $strloginto = get_string('loginto', '', $course->shortname);
@ -70,7 +70,7 @@ class enrolment_plugin_authorize
} }
print_simple_box_start('center'); print_simple_box_start('center');
if (isguest()) { if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM, SITEID), $USER->id, false)) {
$curcost = get_course_cost($course); $curcost = get_course_cost($course);
echo '<div align="center">'; echo '<div align="center">';
echo '<p>'.get_string('paymentrequired').'</p>'; echo '<p>'.get_string('paymentrequired').'</p>';

View file

@ -12,7 +12,7 @@
/// Only site users can access to this page /// Only site users can access to this page
require_login(); // Don't use $courseid! User may want to see old orders. require_login(); // Don't use $courseid! User may want to see old orders.
if (isguest()) { if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM, SITEID), $USER->id, false)) {
error("Guests cannot use this page."); error("Guests cannot use this page.");
} }