示例#1
0
echo "<br/>Secret: <input type\"text\" name=\"secret\" value=\"{$secret}\">\n";
echo "</fieldset><p>";
echo "<fieldset><legend>Launch Data</legend>\n";
foreach ($lmsdata as $k => $val) {
    echo $k . ": <input type=\"text\" name=\"" . $k . "\" value=\"";
    echo htmlspecialchars($val);
    echo "\"><br/>\n";
}
echo "</fieldset><p>";
echo "</form>";
echo "<hr>";
if (!$lmspw) {
    unset($tool_consumer_instance_guid);
}
$parms = $lmsdata;
// Cleanup parms before we sign
foreach ($parms as $k => $val) {
    if (strlen(trim($parms[$k])) < 1) {
        unset($parms[$k]);
    }
}
// Add oauth_callback to be compliant with the 1.0A spec
$parms["oauth_callback"] = "about:blank";
$parms = signParameters($parms, $endpoint, "POST", $key, $secret, "Press to Launch", $tool_consumer_instance_guid, $tool_consumer_instance_description);
$content = postLaunchHTML($parms, $endpoint, true, false);
print $content;
?>
<script>
document.getElementsByName("ext_submit")[0].click();
</script>
示例#2
0
        echo "<p>Error, did not find a launch_url or secure_launch_url in the XML descriptor</p>\n";
        exit;
    }
    $custom = $cx["custom"];
    $parms = array_merge($custom, $lmsdata);
}
// Cleanup parms before we sign
foreach ($parms as $k => $val) {
    if (strlen(trim($parms[$k])) < 1) {
        unset($parms[$k]);
    }
}
// Add oauth_callback to be compliant with the 1.0A spec
$parms["oauth_callback"] = "about:blank";
$parms = signParameters($parms, $endpoint, "POST", $key, $secret, "Press to Launch", $tool_consumer_instance_guid, $tool_consumer_instance_description);
$content = postLaunchHTML($parms, $endpoint, true, "width=\"100%\" height=\"900\" scrolling=\"auto\" frameborder=\"1\" transparency");
print $content;
?>
<hr>
<p>
Note: Unpublished drafts of IMS Specifications are only available to 
IMS members and any software based on an unpublished draft is subject to change.
Sample code is provided to help developers understand the specification more quickly.
Simply interoperating with this sample implementation code does not 
allow one to claim compliance with a specification.
<p>
<a href=http://www.imsglobal.org/toolsinteroperability2.cfm>IMS Learning Tools Interoperability Working Group</a> <br/>
<a href="http://www.imsglobal.org/ProductDirectory/directory.cfm">IMS Compliance Detail</a> <br/>
<a href="http://www.imsglobal.org/community/forum/index.cfm?forumid=11">IMS Developer Community</a> <br/>
<a href="http:///www.imsglobal.org/" class="footerlink">&copy; 2009 IMS Global Learning Consortium, Inc.</a> under the Apache 2 License.</p>
示例#3
0
文件: lms.php 项目: nils-wisiol/sakai
        unset($parms[$k]);
    }
}
// Add oauth_callback to be compliant with the 1.0A spec
$parms["oauth_callback"] = "about:blank";
$parms["lis_outcome_service_url"] = $outcomes;
$parms["content_item_return_url"] = $content_url;
$parms["accept_media_types"] = "application/vnd.ims.lti.v1.ltilink,application/imsccml+xml";
$parms["lis_result_sourcedid"] = '{"zap" : "Siân JSON 1234 Sourcedid <>&lt;"}';
if (strpos($cur_url, "localhost") === FALSE) {
    $parms['launch_presentation_css_url'] = $cssurl;
}
addCustom($parms, array("simple_key" => "custom_simple_value", "Complex!@#\$^*(){}[]KEY" => "Complex!@#\$^*(){}[]½Value"));
if (isset($_REQUEST["cert_num"]) && $secret != "secret" || isset($_POST['launch']) || isset($_POST['debug'])) {
    if ($sha256) {
        $parms['oauth_signature_method'] = 'HMAC-SHA256';
    }
    $parms = signParameters($parms, $endpoint, "POST", $key, $secret, "Finish Launch", $tool_consumer_instance_guid, $tool_consumer_instance_description);
    $where = '_blank';
    if ($iframe) {
        $where = "width=\"100%\" height=\"900\" scrolling=\"auto\" frameborder=\"1\" transparency";
    }
    $content = postLaunchHTML($parms, $endpoint, isset($_POST['debug']), $where);
    global $LastOAuthBodyBaseString;
    if (isset($LastOAuthBodyBaseString) && isset($_POST['debug'])) {
        echo "\n";
        echo '<a href="basecheck.php?b=' . urlencode($LastOAuthBodyBaseString) . '" target="_blank">Base String Comparison Tool</a><br/>';
        echo "\n";
    }
    print $content;
}
示例#4
0
    $lmsdata["ext_ims_lis_memberships_id"] = $sourcedid;
    $lmsdata["ext_ims_lis_memberships_url"] = AT_BASE_HREF . 'mods/_standard/basiclti/launch/service.php';
}
if ($sourcedid !== false && ($basiclti_tool_row['allowsetting'] == 1 || $basiclti_tool_row['allowsetting'] == 2 && $basiclti_content_row['allowsetting'] == 1)) {
    $lmsdata["ext_ims_lti_tool_setting_id"] = $sourcedid;
    $lmsdata["ext_ims_lti_tool_setting_url"] = AT_BASE_HREF . 'mods/_standard/basiclti/launch/service.php';
    $setting = $basiclti_content_row['setting'];
    if (isset($setting)) {
        $lmsdata["ext_ims_lti_tool_setting"] = $setting;
    }
}
//require_once("ims-blti/blti_util.php");
require_once AT_INCLUDE_PATH . "classes/AContent_lcl/ims-blti/blti_util.php";
if (strlen($basiclti_tool_row['customparameters']) > 0) {
    $lmsdata = merge_custom_parameters($lmsdata, $basiclti_tool_row['customparameters']);
}
if ($basiclti_tool_row['customparameters'] == 1 && strlen($basiclti_content_row['customparameters']) > 0) {
    $lmsdata = merge_custom_parameters($lmsdata, $basiclti_content_row['customparameters']);
}
// print_r($lmsdata);echo("<hr>\n");
$parms = $lmsdata;
$endpoint = $basiclti_tool_row['toolurl'];
$key = $basiclti_tool_row['resourcekey'];
$secret = $basiclti_tool_row['password'];
$parms = signParameters($parms, $endpoint, "POST", $key, $secret, "Press to Launch", $tool_consumer_instance_guid, $tool_consumer_instance_description);
$debuglaunch = false;
if ($basiclti_tool_row['debuglaunch'] == 1 || $basiclti_tool_row['debuglaunch'] == 2 && $basiclti_content_row['debuglaunch'] == 1) {
    $debuglaunch = true;
}
$content = postLaunchHTML($parms, $endpoint, $debuglaunch);
print $content;
示例#5
0
文件: tc.php 项目: amoskarugaba/sakai
}
$reg_key = isset($_POST['reg_key']) ? $_POST['reg_key'] : false;
// Add oauth_callback to be compliant with the 1.0A spec
// $parms['launch_presentation_css_url'] = $cssurl;
if (isset($parms['tc_profile_url'])) {
    $parms['tc_profile_url'] .= '?key=' . $reg_key;
    if ($re_register) {
        $parms['tc_profile_url'] .= '&r_key=' . $reg_key . '&r_secret=' . $parms['secret'];
    } else {
        $parms['tc_profile_url'] .= '&r_key=' . $reg_key . '&r_secret=' . $parms['reg_password'];
    }
}
if ($re_register) {
    $parms["oauth_callback"] = "about:blank";
    $key = $_POST['reg_key'];
    $secret = $parms['secret'];
    unset($parms['key']);
    unset($parms['secret']);
    unset($parms['reg_key']);
    unset($parms['reg_password']);
    $tool_consumer_instance_guid = $lmsdata_common['tool_consumer_instance_guid'];
    $tool_consumer_instance_description = $lmsdata_common['tool_consumer_instance_description'];
    $parms = signParameters($parms, $endpoint, "POST", $key, $secret, "Finish Launch", $tool_consumer_instance_guid, $tool_consumer_instance_description);
} else {
    unset($parms['secret']);
}
if (isset($_POST['launch']) || isset($_POST['debug'])) {
    $content = postLaunchHTML($parms, $endpoint, isset($_POST['debug']), "_blank");
    // "width=\"100%\" height=\"900\" scrolling=\"auto\" frameborder=\"1\" transparency");
    print $content;
}
示例#6
0
$oauth_consumer_secret = isset($_REQUEST['secret']) ? $_REQUEST['secret'] : $_SESSION['reg_password'];
$grade = isset($_REQUEST['grade']) ? $_REQUEST['grade'] : '';
$comment = isset($_REQUEST['comment']) ? $_REQUEST['comment'] : '';
if (strlen($oauth_consumer_secret) < 1 || strlen($oauth_consumer_key) < 1 || strlen($result_url) < 1) {
    var_dump($_SESSION);
    die("Must have url, reg_password and reg_key in sesison or as GET parameters");
}
if (isset($_REQUEST['send'])) {
    $parms = array();
    $parms["lti_message_type"] = "ContentItemSelection";
    $parms["lti_version"] = "LTI-1p0";
    $parms["data"] = "Yo Yo";
    $retval = json_encode(getContentJSON($content_url));
    $parms["content_items"] = $retval;
    $parms = signParameters($parms, $result_url, "POST", $oauth_consumer_key, $oauth_consumer_secret, "Finish Content Return");
    $content = postLaunchHTML($parms, $result_url, true);
    echo $content;
    return;
}
?>
<html>
<head>
  <title>IMS Content Item Service</title>
  <?php 
echo ltiUtilToggleHead();
?>
</head>
<body style="font-family:sans-serif; background-color:#add8e6">
<p><b>Calling IMS LTI Content Item Service</b></p>
<?php 
?>
示例#7
0
} else {
    $parms['launch_presentation_locale'] = 'en-US';
}
if ($_GET['target'] == 'new') {
    $parms['launch_presentation_document_target'] = 'window';
} else {
    $parms['launch_presentation_document_target'] = 'iframe';
    $parms['launch_presentation_height'] = '500';
    $parms['launch_presentation_width'] = '600';
}
$parms['launch_presentation_return_url'] = $urlmode . $_SERVER['HTTP_HOST'] . $imasroot . '/course/course.php?cid=' . $cid;
if (isset($CFG['GEN']['LTIorgid'])) {
    $org_id = $CFG['GEN']['LTIorgid'];
} else {
    $org_id = $_SERVER['HTTP_HOST'];
}
$org_desc = $installname;
if ($toolcustomurl != '') {
    $line['url'] = $toolcustomurl;
}
if ($line['url'] == '') {
    echo '<html><body>This tool does not have a default launch URL.  Custom launch URL is required.</body></html>';
    exit;
}
try {
    $parms = signParameters($parms, $line['url'], "POST", $line['ltikey'], $line['secret'], null, $org_id, $org_desc);
    $content = postLaunchHTML($parms, $line['url'], isset($parms['custom_debug']));
    print $content;
} catch (Exception $e) {
    echo $e->getMessage();
}