forked from csev/pythonauto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool.php
More file actions
117 lines (105 loc) · 4.84 KB
/
tool.php
File metadata and controls
117 lines (105 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
error_reporting(E_ALL & ~E_NOTICE);
ini_set("display_errors", 1);
// Load up the LTI Support code
require_once 'util/lti_util.php';
session_start();
header('Content-Type: text/html; charset=utf-8');
// Initialize, all secrets are 'secret', do not set session, and do not redirect
$context = new BLTI("secret", false, false);
?>
<html>
<head>
<title>Sakai External Tool API Test Harness</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body style="font-family:sans-serif; background-color:#add8e6">
<?php
echo("<p><b>Sakai External Tool API Test Harness</b></p>\n");
$sourcedid = $_REQUEST['lis_result_sourcedid'];
if (get_magic_quotes_gpc()) $sourcedid = stripslashes($sourcedid);
$sourcedid = htmlentities($sourcedid);
if ( $context->valid ) {
if ( $_POST['launch_presentation_return_url']) {
$msg = 'A%20message%20from%20the%20tool%20provider.';
$error_msg = 'An%20error%20message%20from%20the%20tool%20provider.';
$sep = (strpos($_POST['launch_presentation_return_url'], '?') === FALSE) ? '?' : '&';
print "<p><a href=\"{$_POST['launch_presentation_return_url']}\">Return to tool consumer</a> (";
print "<a href=\"{$_POST['launch_presentation_return_url']}{$sep}lti_msg={$msg}&lti_log=LTI%20log%20entry:%20{$msg}\">with a message</a> or ";
print "<a href=\"{$_POST['launch_presentation_return_url']}{$sep}lti_errormsg={$error_msg}&lti_errorlog=LTI%20error%20log%20entry:%20{$error_msg}\">with an error</a>";
print ")</p>\n";
}
$found = false;
if ( $_POST['lis_result_sourcedid'] && $_POST['lis_outcome_service_url'] ) {
print "<p>\n";
print '<a href="common/tool_provider_outcome.php?sourcedid='.urlencode($sourcedid);
print '&key='.urlencode($_POST['oauth_consumer_key']);
print '&seret=secret';
print '&url='.urlencode($_POST['lis_outcome_service_url']).'">';
print 'Test LTI 1.1 Outcome Service</a>.</p>'."\n";
}
if ( $_POST['context_id'] && $_POST['ext_lori_api_url_xml'] && $_POST['lis_result_sourcedid'] ) {
print "<p>\n";
print '<a href="ext/lori_xml.php?context_id='.htmlentities($_POST['context_id']);
print '&lis_result_sourcedid='.urlencode($_POST['lis_result_sourcedid']);
print '&user_id='.urlencode($_POST['user_id']);
print '&key='.urlencode($_POST['oauth_consumer_key']);
print '&url='.urlencode($_POST['ext_lori_api_url_xml']).'">';
print 'Test LORI XML API</a>.</p>'."\n";
$found = true;
}
if ( $_POST['ext_ims_lis_memberships_id'] && $_POST['ext_ims_lis_memberships_url'] ) {
print "<p>\n";
print '<a href="ext/memberships.php?id='.htmlentities($_POST['ext_ims_lis_memberships_id']);
print '&key='.urlencode($_POST['oauth_consumer_key']);
print '&url='.urlencode($_POST['ext_ims_lis_memberships_url']).'">';
print 'Test Sakai Roster API</a>.</p>'."\n";
$found = true;
}
if ( $_POST['lis_result_sourcedid'] && $_POST['ext_ims_lis_basic_outcome_url'] ) {
print "<p>\n";
print '<a href="ext/setoutcome.php?sourcedid='.$sourcedid;
print '&key='.urlencode($_POST['oauth_consumer_key']);
print '&url='.urlencode($_POST['ext_ims_lis_basic_outcome_url']).'">';
print 'Test Sakai Outcome API</a>.</p>'."\n";
$found = true;
}
if ( $_POST['ext_ims_lti_tool_setting_id'] && $_POST['ext_ims_lti_tool_setting_url'] ) {
print "<p>\n";
print '<a href="ext/setting.php?id='.htmlentities($_POST['ext_ims_lti_tool_setting_id']);
print '&key='.urlencode($_POST['oauth_consumer_key']);
print '&url='.urlencode($_POST['ext_ims_lti_tool_setting_url']).'">';
print 'Test Sakai Settings API</a>.</p>'."\n";
$found = true;
}
if ( ! $found ) {
echo("<p>This launch did not include the necessary settings for any of the ");
echo("Sakai External Tool API such as:\n<pre>\n");
echo("ext_ims_lis_memberships_url\next_ims_lis_basic_outcome_url\next_ims_lti_tool_setting_url\n");
echo("</pre>\n</p>\n");
}
print "<pre>\n";
print "Context Information:\n\n";
print htmlentities($context->dump());
print "</pre>\n";
} else {
print "<p style=\"color:red\">Could not establish context: ".$context->message."<p>\n";
}
print "<p>Base String:<br/>\n";
print htmlentities($context->basestring);
print "<br/></p>\n";
print "<pre>\n";
print "Raw POST Parameters:\n\n";
ksort($_POST);
foreach($_POST as $key => $value ) {
if (get_magic_quotes_gpc()) $value = stripslashes($value);
print htmlentities($key) . "=" . htmlentities($value) . " (".mb_detect_encoding($value).")\n";
}
print "\nRaw GET Parameters:\n\n";
ksort($_GET);
foreach($_GET as $key => $value ) {
if (get_magic_quotes_gpc()) $value = stripslashes($value);
print htmlentities($key) . "=" . htmlentities($value) . " (".mb_detect_encoding($value).")\n";
}
print "</pre>";
?>