]> git.mjollnir.org Git - moodle.git/commitdiff
Bug #5941 - Myriad of problems with Paypal enrollmemts, part 2 - Login as guest not...
authorskodak <skodak>
Wed, 28 Jun 2006 15:26:31 +0000 (15:26 +0000)
committerskodak <skodak>
Wed, 28 Jun 2006 15:26:31 +0000 (15:26 +0000)
enrol/manual/enrol.html
enrol/paypal/enrol.php

index b41d7b2cc63b878b6bbc1e4f966d48cf4d12efd0..b2f34aad2dfc441c95b796191b0834fe91f6a782 100644 (file)
@@ -37,7 +37,7 @@
     print_simple_box_end();
 
 
-    if ($course->guest) {
+    if ($course->guest and !isguest()) {
       print_simple_box_start('center');
 ?>
       <form name="form" method="post" action="enrol.php">
index b4ad5de73c85f307411dd3521f8af896d2d593c1..f030cb91e3b147fdc100502484147a0202c9f84b 100644 (file)
@@ -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 '<div align="center"><p>'.get_string('paymentrequired').'</p>';
+            echo '<p><b>'.get_string('cost').": $CFG->enrol_currency $cost".'</b></p>';
+            echo '<p><a href="'.$wwwroot.'/login/">'.get_string('loginsite').'</a></p>';
+            echo '</div>';
+        } 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();