2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2009 */
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 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../../include/');
16 $_user_location = 'public';
17 include(AT_INCLUDE_PATH.'vitals.inc.php');
18 include(AT_SOCIAL_INCLUDE.'classes/Application.class.php');
20 if (empty($_GET['st']) || empty($_GET['name']) || ! isset($_GET['value'])) {
21 header("HTTP/1.0 400 Bad Request", true);
22 echo "<html><body><h1>400 - Bad Request</h1></body></html>";
25 $st = urldecode(base64_decode($_GET['st']));
26 $key = urldecode($_GET['name']);
27 $value = urldecode($_GET['value']);
28 $token = BasicSecurityToken::createFromToken($st, 60*60); //TODO: Change 3600 to a constant
29 $app_id = $token->getAppId();
30 // $viewer = $token->getViewerId();
31 debug($app_id,'appid');
32 debug($viewer, 'viewer');
33 debug($value, 'value');
35 $app = new Application($app_id);
37 $result = $app->setApplicationSettings($_SESSION['member_id'], $key, $value);
39 echo "<html><body><h1>500 - SQL Error: </h1>" . mysql_error() . "</body></html>";
42 } catch (Exception $e) {
43 header("HTTP/1.0 400 Bad Request", true);
44 echo "<html><body><h1>400 - Bad Request</h1>" . $e->getMessage() . "</body></html>";