Permalink
Browse files

Bug #5941, Petr's patch is incorrect. Rewritten.

If course cost is 0 then always fall back to manual method. This is not authorize problem if enrolment key is empty and guest access with key.
  • Loading branch information...
1 parent ec4fda2 commit e65b5a1dce57690992316d2382453d1f9049c2e0 ethem committed Jun 29, 2006
Showing with 12 additions and 9 deletions.
  1. +12 −9 enrol/authorize/enrol.php
View
@@ -100,6 +100,16 @@ function get_teacher_courses(&$user) {
function print_entry($course) {
global $CFG, $USER, $form;
+ $zerocost = $this->zero_cost($course);
+ if ($zerocost) {
+ $manual = enrolment_factory::factory('manual');
+ if (!empty($this->errormsg)) {
+ $manual->errormsg = $this->errormsg;
+ }
+ $manual->print_entry($course);
+ return;
+ }
+
httpsrequired();
if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') {
@@ -112,13 +122,6 @@ function print_entry($course) {
}
}
- $zerocost = $this->zero_cost($course);
- if ($zerocost) {
- $manual = enrolment_factory::factory('manual');
- $manual->print_entry($course);
- return;
- }
-
$strcourses = get_string('courses');
$strloginto = get_string('loginto', '', $course->shortname);
@@ -159,10 +162,10 @@ function print_entry($course) {
* @access public
*/
function check_entry($form, $course) {
- if (!empty($course->password) and !empty($form->password)) {
+ if ($this->zero_cost($course) or (!empty($course->password) and !empty($form->password))) {
$manual = enrolment_factory::factory('manual');
$manual->check_entry($form, $course);
- if (isset($manual->errormsg)) {
+ if (!empty($manual->errormsg)) {
$this->errormsg = $manual->errormsg;
}
} elseif ((!empty($form->ccsubmit)) and $this->validate_enrol_form($form)) {

0 comments on commit e65b5a1

Please sign in to comment.