MDL-20534
authorCharles Severance <csev@umich.edu>
Tue, 15 Nov 2011 20:47:26 +0000 (15:47 -0500)
committerChris Scribner <scriby@gmail.com>
Thu, 17 Nov 2011 15:34:58 +0000 (10:34 -0500)
Add the tool_consumer_info fields and fix parsing of custom parameters.

mod/lti/locallib.php

index 2465085..bb53e6f 100644 (file)
@@ -173,6 +173,9 @@ function lti_view($instance) {
         $requestparams['launch_presentation_return_url'] = $returnurl;
     }
 
         $requestparams['launch_presentation_return_url'] = $returnurl;
     }
 
+    $requestparams['tool_consumer_info_product_family_code'] = 'moodle';
+    $requestparams['tool_consumer_info_version'] = strval($CFG->version);
+
     if (!empty($key) && !empty($secret)) {
         $parms = lti_sign_parameters($requestparams, $endpoint, "POST", $key, $secret);
     } else {
     if (!empty($key) && !empty($secret)) {
         $parms = lti_sign_parameters($requestparams, $endpoint, "POST", $key, $secret);
     } else {
@@ -422,7 +425,7 @@ function lti_split_custom_parameters($customstr) {
             continue;
         }
         $key = trim($textlib->substr($line, 0, $pos));
             continue;
         }
         $key = trim($textlib->substr($line, 0, $pos));
-        $val = trim($textlib->substr($line, $pos+1));
+        $val = trim($textlib->substr($line, $pos+1, strlen($line)));
         $key = lti_map_keyname($key);
         $retval['custom_'.$key] = $val;
     }
         $key = lti_map_keyname($key);
         $retval['custom_'.$key] = $val;
     }