2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg */
6 /* Adaptive Technology Resource Centre / University of Toronto */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
13 // $Id: index.php 5901 2006-02-07 17:13:41Z joel $
15 define('AT_INCLUDE_PATH', '../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
18 function createToken ($token, $sharedSecret) {
19 //String time = Long.toString(System.currentTimeMillis());
20 $time = mktime() . '000';
22 //String toMd5 = token+time+sharedSecret;
23 $toMd5 = $token . $time . $sharedSecret;
25 //String enctoken = URLEncoder.encode(token, "UTF-8");
26 $enctoken = urlencode($token);
28 //byte[] bytes = new Md5(toMd5).getDigest();
29 $bytes = pack('H*', md5($toMd5));
31 //BASE64Encoder encoder = new BASE64Encoder();
32 //String fullToken = enctoken+':'+time+':'+encoder.encode(bytes);
34 $fullToken = $enctoken . ':' . $time . ':' . base64_encode($bytes);
39 require (AT_INCLUDE_PATH.'header.inc.php');
41 if (!isset($_config['tle_server']) || !$_config['tle_server']) {
42 $msg->printErrors('TLE_MISSING_SERVER');
44 $callback = $_base_href . 'mods/tle/import.php?';
46 $url = $_config['tle_server'] . '?method=lms'
47 . '&returnurl=' . urlencode($callback)
48 . '&action=searchResources'
50 . '&template=standard'
51 . '&token=' . urlencode(createToken($_config['tle_username'], $_config['tle_secret']));
53 echo '<iframe src="'. $url . '" width="620" height="600" frameborder="0" /></iframe>';
55 require(AT_INCLUDE_PATH.'footer.inc.php');