From e87fe61524e2ab9cb7d12283bc5a0908149ee7a1 Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 28 Jun 2006 15:26:31 +0000 Subject: [PATCH] Bug #5941 - Myriad of problems with Paypal enrollmemts, part 2 - Login as guest not shown to guests and there is login link instead of paypal button for guests; merged from MOODLE_16_STABLE --- enrol/manual/enrol.html | 2 +- enrol/paypal/enrol.php | 36 +++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/enrol/manual/enrol.html b/enrol/manual/enrol.html index b41d7b2cc6..b2f34aad2d 100644 --- a/enrol/manual/enrol.html +++ b/enrol/manual/enrol.html @@ -37,7 +37,7 @@ print_simple_box_end(); - if ($course->guest) { + if ($course->guest and !isguest()) { print_simple_box_start('center'); ?>
diff --git a/enrol/paypal/enrol.php b/enrol/paypal/enrol.php index b4ad5de73c..f030cb91e3 100644 --- a/enrol/paypal/enrol.php +++ b/enrol/paypal/enrol.php @@ -39,21 +39,35 @@ function print_entry($course) { print_course($course, "80%"); if ($course->password) { // Presenting two options - print_simple_box(get_string('costorkey', 'enrol_paypal'), 'center'); + print_heading(get_string('costorkey', 'enrol_paypal'), 'center'); } print_simple_box_start("center"); - //Sanitise some fields before building the PayPal form - $coursefullname = $this->sanitise_for_paypal($course->fullname); - $courseshortname = $this->sanitise_for_paypal($course->shortname); - $userfullname = $this->sanitise_for_paypal(fullname($USER)); - $userfirstname = $this->sanitise_for_paypal($USER->firstname); - $userlastname = $this->sanitise_for_paypal($USER->lastname); - $useraddress = $this->sanitise_for_paypal($USER->address); - $usercity = $this->sanitise_for_paypal($USER->city); - - include($CFG->dirroot.'/enrol/paypal/enrol.html'); + if (isguest()) { + if (empty($CFG->loginhttps)) { + $wwwroot = $CFG->wwwroot; + } else { + // This actually is not so secure ;-), 'cause we're + // in unencrypted connection... + $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); + } + echo '

'.get_string('paymentrequired').'

'; + echo '

'.get_string('cost').": $CFG->enrol_currency $cost".'

'; + echo '

'.get_string('loginsite').'

'; + echo '
'; + } else { + //Sanitise some fields before building the PayPal form + $coursefullname = $this->sanitise_for_paypal($course->fullname); + $courseshortname = $this->sanitise_for_paypal($course->shortname); + $userfullname = $this->sanitise_for_paypal(fullname($USER)); + $userfirstname = $this->sanitise_for_paypal($USER->firstname); + $userlastname = $this->sanitise_for_paypal($USER->lastname); + $useraddress = $this->sanitise_for_paypal($USER->address); + $usercity = $this->sanitise_for_paypal($USER->city); + + include($CFG->dirroot.'/enrol/paypal/enrol.html'); + } print_simple_box_end(); -- 2.39.5