Index: shindig_integrator.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/ShindigIntegrator/shindig_integrator/shindig_integrator.module retrieving revision 1.1 diff -b -r1.1 shindig_integrator.module 89a90 > 'save application prefs', 145a147,153 > $items['pref/set'] = array( > 'title' => t('Save Prefs'), > 'description' => t('A place where prefs are saved'), > 'page callback' => 'pref_set', > 'access arguments' =>array('save application prefs'), > 'type' => MENU_CALLBACK); > 684,686c690,700 < .'&parent='. urlencode('http://'. $_SERVER['HTTP_HOST']) < . $prefs < . (isset($_REQUEST['appParams']) ? '&view-params='. urlencode($_REQUEST['appParams']):'') --- > .'&parent='. urlencode('http://'. $_SERVER['HTTP_HOST']); > > $res = db_query("SELECT name, value FROM {application_settings} > WHERE module_id = %d AND user_id = %d AND application_id = %d", $mod_id, $viewer_id, $gadget->id); > > while ($setting = db_fetch_array($res)) { > $iframe_url .= '&up_' . urlencode($setting['name']) . '=' . urlencode($setting['value']); > } > > $iframe_url .= > (isset($_REQUEST['appParams']) ? '&view-params='. urlencode($_REQUEST['appParams']):'') 737a757,793 > > function pref_set() { > if (empty($_GET['st']) || empty($_GET['name']) || ! isset($_GET['value'])) { > header("HTTP/1.0 400 Bad Request", true); > echo "

400 - Bad Request

"; > } > else { > module_load_include('php', 'shindig_integrator', '/shindig/php/src/common/Config'); > module_load_include('php', 'shindig_integrator', '/shindig/php/src/common/SecurityToken'); > module_load_include('php', 'shindig_integrator', '/shindig/php/src/common/BlobCrypter'); > module_load_include('php', 'shindig_integrator', '/shindig/php/src/common/sample/BasicSecurityToken'); > module_load_include('php', 'shindig_integrator', '/shindig/php/src/common/sample/BasicBlobCrypter'); > module_load_include('php', 'shindig_integrator', '/shindig/php/src/common/sample/Crypto'); > module_load_include('php', 'shindig_integrator', '/shindig/php/config/local'); > > $st = urldecode(base64_decode($_GET['st'])); > $key = urldecode($_GET['name']); > $value = urldecode($_GET['value']); > $token = BasicSecurityToken::createFromToken($st, Config::get('token_max_age')); > $app_id = $token->getAppId(); > $viewer = $token->getViewerId(); > > $result_get_mod_id = db_query("SELECT id FROM {user_applications} WHERE user_id = %d AND application_id = %d", > $viewer, $app_id); > if(!$result_get_mod_id) { > return FALSE; > } > $record_get_mod_id = db_fetch_object($result_get_mod_id); > $mod_id = $record_get_mod_id->id; > > db_query("INSERT INTO {application_settings} (application_id, user_id, module_id, name, value) > VALUES (%d, %d, %d, '%s', '%s') > ON DUPLICATE key UPDATE value = '%s'", > $app_id, $viewer, $mod_id, $key, $value, $value > ); > } > }