Skip to content

Commit

Permalink
Fix a bug introduced recently that broke launches (adding the return …
Browse files Browse the repository at this point in the history
…url after signing). Trim the launch URL to prevent signature errors.
  • Loading branch information
scriby committed Nov 7, 2011
1 parent 3dd9ca2 commit 9d57ad1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions mod/lti/locallib.php
Expand Up @@ -124,6 +124,8 @@ function lti_view($instance) {
} }


$endpoint = !empty($instance->toolurl) ? $instance->toolurl : $typeconfig['toolurl']; $endpoint = !empty($instance->toolurl) ? $instance->toolurl : $typeconfig['toolurl'];
$endpiont = trim($endpoint);

$orgid = $typeconfig['organizationid']; $orgid = $typeconfig['organizationid'];
/* Suppress this for now - Chuck /* Suppress this for now - Chuck
$orgdesc = $typeconfig['organizationdescr']; $orgdesc = $typeconfig['organizationdescr'];
Expand All @@ -143,19 +145,21 @@ function lti_view($instance) {
$requestparams["tool_consumer_instance_guid"] = $orgid; $requestparams["tool_consumer_instance_guid"] = $orgid;
} }


if(empty($key) || empty($secret)){
$returnurlparams['unsigned'] = '1';

//Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns
$url = new moodle_url('/mod/lti/return.php', $returnurlparams);
$parms['launch_presentation_return_url'] = $url->out(false);
}

if(!empty($key) && !empty($secret)){ if(!empty($key) && !empty($secret)){
$parms = lti_sign_parameters($requestparams, $endpoint, "POST", $key, $secret); $parms = lti_sign_parameters($requestparams, $endpoint, "POST", $key, $secret);
} else { } else {
//If no key and secret, do the launch unsigned. //If no key and secret, do the launch unsigned.
$parms = $requestparams; $parms = $requestparams;

$returnurlparams['unsigned'] = '1';
} }


//Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns
$url = new moodle_url('/mod/lti/return.php', $returnurlparams);
$parms['launch_presentation_return_url'] = $url->out(false);

$debuglaunch = ( $instance->debuglaunch == 1 ); $debuglaunch = ( $instance->debuglaunch == 1 );


$content = lti_post_launch_html($parms, $endpoint, $debuglaunch); $content = lti_post_launch_html($parms, $endpoint, $debuglaunch);
Expand Down Expand Up @@ -230,12 +234,12 @@ function lti_build_request($instance, $typeconfig, $course) {
$requestparams["ext_ims_lis_basic_outcome_url"] = $CFG->wwwroot.'/mod/lti/service.php'; $requestparams["ext_ims_lis_basic_outcome_url"] = $CFG->wwwroot.'/mod/lti/service.php';
} }


if ( isset($placementsecret) && /*if ( isset($placementsecret) &&
( $typeconfig['allowroster'] == LTI_SETTING_ALWAYS || ( $typeconfig['allowroster'] == LTI_SETTING_ALWAYS ||
( $typeconfig['allowroster'] == LTI_SETTING_DELEGATE && $instance->instructorchoiceallowroster == LTI_SETTING_ALWAYS ) ) ) { ( $typeconfig['allowroster'] == LTI_SETTING_DELEGATE && $instance->instructorchoiceallowroster == LTI_SETTING_ALWAYS ) ) ) {
$requestparams["ext_ims_lis_memberships_id"] = $sourcedid; $requestparams["ext_ims_lis_memberships_id"] = $sourcedid;
$requestparams["ext_ims_lis_memberships_url"] = $CFG->wwwroot.'/mod/lti/service.php'; $requestparams["ext_ims_lis_memberships_url"] = $CFG->wwwroot.'/mod/lti/service.php';
} }*/


// Send user's name and email data if appropriate // Send user's name and email data if appropriate
if ( $typeconfig['sendname'] == LTI_SETTING_ALWAYS || if ( $typeconfig['sendname'] == LTI_SETTING_ALWAYS ||
Expand Down

0 comments on commit 9d57ad1

Please sign in to comment.