Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix a bug introduced recently that broke launches (adding the return …

…url after signing). Trim the launch URL to prevent signature errors.
  • Loading branch information...
commit 9d57ad1737f0e67d8aab54718d827274a1be1d7d 1 parent 3dd9ca2
scriby authored October 12, 2011

Showing 1 changed file with 12 additions and 8 deletions. Show diff stats Hide diff stats

  1. 20  mod/lti/locallib.php
20  mod/lti/locallib.php
@@ -124,6 +124,8 @@ function lti_view($instance) {
124 124
     }
125 125
     
126 126
     $endpoint = !empty($instance->toolurl) ? $instance->toolurl : $typeconfig['toolurl'];
  127
+    $endpiont = trim($endpoint);
  128
+    
127 129
     $orgid = $typeconfig['organizationid'];
128 130
     /* Suppress this for now - Chuck
129 131
     $orgdesc = $typeconfig['organizationdescr'];
@@ -143,19 +145,21 @@ function lti_view($instance) {
143 145
         $requestparams["tool_consumer_instance_guid"] = $orgid;
144 146
     }
145 147
     
  148
+    if(empty($key) || empty($secret)){
  149
+        $returnurlparams['unsigned'] = '1';
  150
+        
  151
+        //Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns
  152
+    $url = new moodle_url('/mod/lti/return.php', $returnurlparams);
  153
+        $parms['launch_presentation_return_url'] = $url->out(false);    
  154
+    }
  155
+    
146 156
     if(!empty($key) && !empty($secret)){
147 157
         $parms = lti_sign_parameters($requestparams, $endpoint, "POST", $key, $secret);
148 158
     } else {
149 159
         //If no key and secret, do the launch unsigned.
150 160
         $parms = $requestparams;
151  
-        
152  
-        $returnurlparams['unsigned'] = '1';
153 161
     }
154 162
     
155  
-    //Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns
156  
-    $url = new moodle_url('/mod/lti/return.php', $returnurlparams);
157  
-    $parms['launch_presentation_return_url'] = $url->out(false);
158  
-    
159 163
     $debuglaunch = ( $instance->debuglaunch == 1 );
160 164
     
161 165
     $content = lti_post_launch_html($parms, $endpoint, $debuglaunch);
@@ -230,12 +234,12 @@ function lti_build_request($instance, $typeconfig, $course) {
230 234
         $requestparams["ext_ims_lis_basic_outcome_url"] = $CFG->wwwroot.'/mod/lti/service.php';
231 235
     }
232 236
 
233  
-    if ( isset($placementsecret) &&
  237
+    /*if ( isset($placementsecret) &&
234 238
          ( $typeconfig['allowroster'] == LTI_SETTING_ALWAYS ||
235 239
          ( $typeconfig['allowroster'] == LTI_SETTING_DELEGATE && $instance->instructorchoiceallowroster == LTI_SETTING_ALWAYS ) ) ) {
236 240
         $requestparams["ext_ims_lis_memberships_id"] = $sourcedid;
237 241
         $requestparams["ext_ims_lis_memberships_url"] = $CFG->wwwroot.'/mod/lti/service.php';
238  
-    }
  242
+    }*/
239 243
 
240 244
     // Send user's name and email data if appropriate
241 245
     if ( $typeconfig['sendname'] == LTI_SETTING_ALWAYS ||

0 notes on commit 9d57ad1

Please sign in to comment.
Something went wrong with that request. Please try again.