]> git.mjollnir.org Git - moodle.git/commitdiff
mnet: Some very minor style (etc) fixes
authormartinlanghoff <martinlanghoff>
Thu, 4 Jan 2007 03:32:55 +0000 (03:32 +0000)
committermartinlanghoff <martinlanghoff>
Thu, 4 Jan 2007 03:32:55 +0000 (03:32 +0000)
Author: Donal McMullan <donal@catalyst.net.nz>

admin/index.php
admin/mnet/index.html
admin/mnet/index.php
admin/mnet/peers.php
mnet/lib.php

index fe54b03557fc374acc93bcb30c968a37da91d5d1..181af4fc61d2bef4a874962c90d1ea004d46fda8 100644 (file)
         $guest->lastname    = " ";
         $guest->email       = "root@localhost";
         $guest->description = addslashes(get_string("guestuserinfo"));
-        $guest->mnethostid   = $CFG->mnet_localhost_id;
+        $guest->mnethostid  = $CFG->mnet_localhost_id;
         $guest->confirmed   = 1;
         $guest->lang        = $CFG->lang;
         $guest->timemodified= time();
index 6b0359f627ca9cc8cdcfafa9d4ec3d6c04380b29..c4e375402f7081c6a303c6920bde2a8e4459e056 100644 (file)
@@ -12,7 +12,7 @@ admin_externalpage_print_header($adminroot);
                 </tr>
                 <tr valign="top">
                     <td align="right">Public Key:</td>
-                    <td><pre><?php echo $keypair['certificate']; ?></pre></td>
+                    <td><pre><?php echo $MNET->public_key; ?></pre></td>
                 </tr>
                 <tr valign="top">
                     <td align="right">Networking:</td>
index 5620141f254d10d10c418a400920e796df9b998c..9de415474de64a1cc1efd37dcf7a2587a9eaad40 100644 (file)
@@ -22,8 +22,6 @@
         error('PHP Curl library is not installed');
     }
 
-    $keypair = unserialize($CFG->openssl);
-
     if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
 
 /// If data submitted, process and store
index 52c3793b6a11359ee1f6e87cf49321ca01656775..8ed34d57bb104a4fe564d8dbc2754c484b6a91e2 100644 (file)
@@ -35,8 +35,6 @@ $strmnetservices   = get_string('mnetservices', 'mnet');
 $strmnetlog        = get_string('mnetlog', 'mnet');
 $strmnetedithost   = get_string('reviewhostdetails', 'mnet');
 
-$keypair = unserialize($CFG->openssl);
-
 if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
 
 /// If data submitted, process and store
index b078db7383614d0d84059ca5fd95cc2b525ffceb..ced60f647f50ff885d6143988ca864a6e0bb74b5 100644 (file)
@@ -152,6 +152,7 @@ function mnet_sign_message($message) {
         </Signature>
         <object ID="XMLRPC-MSG">'.base64_encode($message).'</object>
         <wwwroot>'.$MNET->wwwroot.'</wwwroot>
+        <timestamp>'.time().'</timestamp>
     </signedMessage>';
     return $message;
 }
@@ -274,37 +275,48 @@ function mnet_generate_keypair($dn = null) {
     $break = strpos($host.'/' , '/');
     $host   = substr($host, 0, $break);
 
-    if ($result = get_record_select('course'," id ='1' ")) {
+    if ($result = get_record_select('course'," id ='".SITEID."' ")) {
         $organization = $result->fullname;
     } else {
         $organization = 'None';
     }
 
     $keypair = array();
-    // TODO: fix this with a redirect, form, etc.
+
+    $country  = 'NZ';
+    $province = 'Wellington';
+    $locality = 'Wellington';
+    $email    = $CFG->noreplyaddress;
+
+    if(!empty($USER->country)) {
+        $country  = $USER->country;
+    }
+    if(!empty($USER->city)) {
+        $province = $USER->city;
+        $locality = $USER->city;
+    }
+    if(!empty($USER->email)) {
+        $email    = $USER->email;
+    }
 
     if (is_null($dn)) {
         $dn = array(
-           "countryName" => 'NZ',
-           "stateOrProvinceName" => 'Wellington',
-           "localityName" => 'Wellington',
+           "countryName" => $country,
+           "stateOrProvinceName" => $province,
+           "localityName" => $locality,
            "organizationName" => $organization,
            "organizationalUnitName" => 'Moodle',
            "commonName" => $CFG->wwwroot,
-           "emailAddress" => $CFG->noreplyaddress
+           "emailAddress" => $email
         );
     }
 
     $new_key = openssl_pkey_new();
     $csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
     $selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, 365);
-
-    // You'll want to keep your certificate signing request, so we'll
-    // export that to a property - csr_txt.
-    openssl_csr_export($csr_rsc, $csr_txt);
     unset($csr_rsc); // Free up the resource
 
-    // We export our self-signed certificate to a string as well.
+    // We export our self-signed certificate to a string.
     openssl_x509_export($selfSignedCert, $keypair['certificate']);
     openssl_x509_free($selfSignedCert);